azurermWebPubsubNetworkAcl
Manages the Network ACL for a Web Pubsub.
Example Usage
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
this,
"example",
{
location: "east us",
name: "terraform-webpubsub",
}
);
const azurermVirtualNetworkExample = new azurerm.virtualNetwork.VirtualNetwork(
this,
"example_1",
{
address_space: ["10.5.0.0/16"],
location: azurermResourceGroupExample.location,
name: "example-vnet",
resource_group_name: azurermResourceGroupExample.name,
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermVirtualNetworkExample.overrideLogicalId("example");
const azurermWebPubsubExample = new azurerm.webPubsub.WebPubsub(
this,
"example_2",
{
capacity: 1,
location: azurermResourceGroupExample.location,
name: "tfex-webpubsub",
resource_group_name: azurermResourceGroupExample.name,
sku: "Standard_S1",
}
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermWebPubsubExample.overrideLogicalId("example");
const azurermSubnetExample = new azurerm.subnet.Subnet(this, "example_3", {
address_prefixes: ["10.5.2.0/24"],
enforce_private_link_endpoint_network_policies: true,
name: "example-subnet",
resource_group_name: azurermResourceGroupExample.name,
virtual_network_name: azurermVirtualNetworkExample.name,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermSubnetExample.overrideLogicalId("example");
const azurermPrivateEndpointExample =
new azurerm.privateEndpoint.PrivateEndpoint(this, "example_4", {
location: azurermResourceGroupExample.location,
name: "example-privateendpoint",
private_service_connection: [
{
is_manual_connection: false,
name: "psc-sig-test",
private_connection_resource_id: azurermWebPubsubExample.id,
subresource_names: ["webpubsub"],
},
],
resource_group_name: azurermResourceGroupExample.name,
subnet_id: azurermSubnetExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermPrivateEndpointExample.overrideLogicalId("example");
const azurermWebPubsubNetworkAclExample =
new azurerm.webPubsubNetworkAcl.WebPubsubNetworkAcl(this, "example_5", {
default_action: "Allow",
depends_on: [`\${${azurermPrivateEndpointExample.fqn}}`],
private_endpoint: [
{
denied_request_types: ["RESTAPI", "ClientConnection"],
id: azurermPrivateEndpointExample.id,
},
],
public_network: [
{
denied_request_types: ["ClientConnection"],
},
],
web_pubsub_id: azurermWebPubsubExample.id,
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermWebPubsubNetworkAclExample.overrideLogicalId("example");
Argument Reference
The following arguments are supported:
-
webPubsubId
- (Required) The ID of the Web Pubsub service. Changing this forces a new resource to be created. -
defaultAction
- (Optional) The default action to control the network access when no other rule matches. Possible values areallow
anddeny
. Defaults todeny
. -
publicNetwork
- (Required) ApublicNetwork
block as defined below. -
privateEndpoint
- (Optional) AprivateEndpoint
block as defined below.
A publicNetwork
block supports the following:
-
allowedRequestTypes
- (Optional) The allowed request types for the public network. Possible values areclientConnection
,serverConnection
,restapi
andtrace
. -
deniedRequestTypes
- (Optional) The denied request types for the public network. Possible values areclientConnection
,serverConnection
,restapi
andtrace
.
-> NOTE: When defaultAction
is allow
, allowedRequestTypes
cannot be set. When defaultAction
is deny
, deniedRequestTypes
cannot be set.
A privateEndpoint
block supports the following:
-
id
- (Required) The ID of the Private Endpoint which is based on the Web Pubsub service. -
allowedRequestTypes
- (Optional) The allowed request types for the Private Endpoint Connection. Possible values areclientConnection
,serverConnection
,restapi
andtrace
. -
deniedRequestTypes
- (Optional) The denied request types for the Private Endpoint Connection. Possible values areclientConnection
,serverConnection
,restapi
andtrace
.
-> NOTE: When defaultAction
is allow
, allowedRequestTypes
cannot be set. When defaultAction
is deny
, deniedRequestTypes
cannot be set.
Attributes Reference
In addition to the Arguments listed above - the following Attributes are exported:
id
- The ID of the Web Pubsub service.
Timeouts
The timeouts
block allows you to specify timeouts for certain actions:
create
- (Defaults to 30 minutes) Used when creating the Network ACL of the Web Pubsub serviceread
- (Defaults to 5 minutes) Used when retrieving the Network ACL of the Web Pubsub serviceupdate
- (Defaults to 30 minutes) Used when updating the Network ACL of the Web Pubsub servicedelete
- (Defaults to 30 minutes) Used when deleting the Network ACL of the Web Pubsub service
Import
Network ACLs for a Web Pubsub service can be imported using the resourceId
, e.g.