tencentcloud.VpcAclAttachment
Explore with Pulumi AI
Provide a resource to attach an existing subnet to Network ACL.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const zones = tencentcloud.getAvailabilityZones({});
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
const subnet = new tencentcloud.Subnet("subnet", {
vpcId: vpc.vpcId,
cidrBlock: "10.0.0.0/16",
availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
});
const example = new tencentcloud.VpcAcl("example", {
vpcId: vpc.vpcId,
ingresses: [
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
],
egresses: [
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
],
});
const attachment = new tencentcloud.VpcAclAttachment("attachment", {
aclId: example.vpcAclId,
subnetId: subnet.subnetId,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
zones = tencentcloud.get_availability_zones()
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
subnet = tencentcloud.Subnet("subnet",
vpc_id=vpc.vpc_id,
cidr_block="10.0.0.0/16",
availability_zone=zones.zones[0].name)
example = tencentcloud.VpcAcl("example",
vpc_id=vpc.vpc_id,
ingresses=[
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
],
egresses=[
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
])
attachment = tencentcloud.VpcAclAttachment("attachment",
acl_id=example.vpc_acl_id,
subnet_id=subnet.subnet_id)
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
zones, err := tencentcloud.GetAvailabilityZones(ctx, &tencentcloud.GetAvailabilityZonesArgs{}, nil)
if err != nil {
return err
}
vpc, err := tencentcloud.NewVpc(ctx, "vpc", &tencentcloud.VpcArgs{
CidrBlock: pulumi.String("10.0.0.0/16"),
})
if err != nil {
return err
}
subnet, err := tencentcloud.NewSubnet(ctx, "subnet", &tencentcloud.SubnetArgs{
VpcId: vpc.VpcId,
CidrBlock: pulumi.String("10.0.0.0/16"),
AvailabilityZone: pulumi.String(zones.Zones[0].Name),
})
if err != nil {
return err
}
example, err := tencentcloud.NewVpcAcl(ctx, "example", &tencentcloud.VpcAclArgs{
VpcId: vpc.VpcId,
Ingresses: pulumi.StringArray{
pulumi.String("ACCEPT#192.168.1.0/24#800#TCP"),
pulumi.String("ACCEPT#192.168.1.0/24#800-900#TCP"),
},
Egresses: pulumi.StringArray{
pulumi.String("ACCEPT#192.168.1.0/24#800#TCP"),
pulumi.String("ACCEPT#192.168.1.0/24#800-900#TCP"),
},
})
if err != nil {
return err
}
_, err = tencentcloud.NewVpcAclAttachment(ctx, "attachment", &tencentcloud.VpcAclAttachmentArgs{
AclId: example.VpcAclId,
SubnetId: subnet.SubnetId,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;
return await Deployment.RunAsync(() =>
{
var zones = Tencentcloud.GetAvailabilityZones.Invoke();
var vpc = new Tencentcloud.Vpc("vpc", new()
{
CidrBlock = "10.0.0.0/16",
});
var subnet = new Tencentcloud.Subnet("subnet", new()
{
VpcId = vpc.VpcId,
CidrBlock = "10.0.0.0/16",
AvailabilityZone = zones.Apply(getAvailabilityZonesResult => getAvailabilityZonesResult.Zones[0]?.Name),
});
var example = new Tencentcloud.VpcAcl("example", new()
{
VpcId = vpc.VpcId,
Ingresses = new[]
{
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
},
Egresses = new[]
{
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP",
},
});
var attachment = new Tencentcloud.VpcAclAttachment("attachment", new()
{
AclId = example.VpcAclId,
SubnetId = subnet.SubnetId,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.TencentcloudFunctions;
import com.pulumi.tencentcloud.inputs.GetAvailabilityZonesArgs;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.VpcAcl;
import com.pulumi.tencentcloud.VpcAclArgs;
import com.pulumi.tencentcloud.VpcAclAttachment;
import com.pulumi.tencentcloud.VpcAclAttachmentArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var zones = TencentcloudFunctions.getAvailabilityZones();
var vpc = new Vpc("vpc", VpcArgs.builder()
.cidrBlock("10.0.0.0/16")
.build());
var subnet = new Subnet("subnet", SubnetArgs.builder()
.vpcId(vpc.vpcId())
.cidrBlock("10.0.0.0/16")
.availabilityZone(zones.applyValue(getAvailabilityZonesResult -> getAvailabilityZonesResult.zones()[0].name()))
.build());
var example = new VpcAcl("example", VpcAclArgs.builder()
.vpcId(vpc.vpcId())
.ingresses(
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP")
.egresses(
"ACCEPT#192.168.1.0/24#800#TCP",
"ACCEPT#192.168.1.0/24#800-900#TCP")
.build());
var attachment = new VpcAclAttachment("attachment", VpcAclAttachmentArgs.builder()
.aclId(example.vpcAclId())
.subnetId(subnet.subnetId())
.build());
}
}
resources:
vpc:
type: tencentcloud:Vpc
properties:
cidrBlock: 10.0.0.0/16
subnet:
type: tencentcloud:Subnet
properties:
vpcId: ${vpc.vpcId}
cidrBlock: 10.0.0.0/16
availabilityZone: ${zones.zones[0].name}
example:
type: tencentcloud:VpcAcl
properties:
vpcId: ${vpc.vpcId}
ingresses:
- ACCEPT#192.168.1.0/24#800#TCP
- ACCEPT#192.168.1.0/24#800-900#TCP
egresses:
- ACCEPT#192.168.1.0/24#800#TCP
- ACCEPT#192.168.1.0/24#800-900#TCP
attachment:
type: tencentcloud:VpcAclAttachment
properties:
aclId: ${example.vpcAclId}
subnetId: ${subnet.subnetId}
variables:
zones:
fn::invoke:
function: tencentcloud:getAvailabilityZones
arguments: {}
Create VpcAclAttachment Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new VpcAclAttachment(name: string, args: VpcAclAttachmentArgs, opts?: CustomResourceOptions);
@overload
def VpcAclAttachment(resource_name: str,
args: VpcAclAttachmentArgs,
opts: Optional[ResourceOptions] = None)
@overload
def VpcAclAttachment(resource_name: str,
opts: Optional[ResourceOptions] = None,
acl_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_acl_attachment_id: Optional[str] = None)
func NewVpcAclAttachment(ctx *Context, name string, args VpcAclAttachmentArgs, opts ...ResourceOption) (*VpcAclAttachment, error)
public VpcAclAttachment(string name, VpcAclAttachmentArgs args, CustomResourceOptions? opts = null)
public VpcAclAttachment(String name, VpcAclAttachmentArgs args)
public VpcAclAttachment(String name, VpcAclAttachmentArgs args, CustomResourceOptions options)
type: tencentcloud:VpcAclAttachment
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args VpcAclAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args VpcAclAttachmentArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args VpcAclAttachmentArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args VpcAclAttachmentArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args VpcAclAttachmentArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
VpcAclAttachment Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The VpcAclAttachment resource accepts the following input properties:
- Acl
Id string - ID of the attached ACL.
- Subnet
Id string - The Subnet instance ID.
- Vpc
Acl stringAttachment Id - ID of the resource.
- Acl
Id string - ID of the attached ACL.
- Subnet
Id string - The Subnet instance ID.
- Vpc
Acl stringAttachment Id - ID of the resource.
- acl
Id String - ID of the attached ACL.
- subnet
Id String - The Subnet instance ID.
- vpc
Acl StringAttachment Id - ID of the resource.
- acl
Id string - ID of the attached ACL.
- subnet
Id string - The Subnet instance ID.
- vpc
Acl stringAttachment Id - ID of the resource.
- acl_
id str - ID of the attached ACL.
- subnet_
id str - The Subnet instance ID.
- vpc_
acl_ strattachment_ id - ID of the resource.
- acl
Id String - ID of the attached ACL.
- subnet
Id String - The Subnet instance ID.
- vpc
Acl StringAttachment Id - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the VpcAclAttachment resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing VpcAclAttachment Resource
Get an existing VpcAclAttachment resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: VpcAclAttachmentState, opts?: CustomResourceOptions): VpcAclAttachment
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
acl_id: Optional[str] = None,
subnet_id: Optional[str] = None,
vpc_acl_attachment_id: Optional[str] = None) -> VpcAclAttachment
func GetVpcAclAttachment(ctx *Context, name string, id IDInput, state *VpcAclAttachmentState, opts ...ResourceOption) (*VpcAclAttachment, error)
public static VpcAclAttachment Get(string name, Input<string> id, VpcAclAttachmentState? state, CustomResourceOptions? opts = null)
public static VpcAclAttachment get(String name, Output<String> id, VpcAclAttachmentState state, CustomResourceOptions options)
resources: _: type: tencentcloud:VpcAclAttachment get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Acl
Id string - ID of the attached ACL.
- Subnet
Id string - The Subnet instance ID.
- Vpc
Acl stringAttachment Id - ID of the resource.
- Acl
Id string - ID of the attached ACL.
- Subnet
Id string - The Subnet instance ID.
- Vpc
Acl stringAttachment Id - ID of the resource.
- acl
Id String - ID of the attached ACL.
- subnet
Id String - The Subnet instance ID.
- vpc
Acl StringAttachment Id - ID of the resource.
- acl
Id string - ID of the attached ACL.
- subnet
Id string - The Subnet instance ID.
- vpc
Acl stringAttachment Id - ID of the resource.
- acl_
id str - ID of the attached ACL.
- subnet_
id str - The Subnet instance ID.
- vpc_
acl_ strattachment_ id - ID of the resource.
- acl
Id String - ID of the attached ACL.
- subnet
Id String - The Subnet instance ID.
- vpc
Acl StringAttachment Id - ID of the resource.
Import
Acl attachment can be imported using the id, e.g.
$ pulumi import tencentcloud:index/vpcAclAttachment:VpcAclAttachment attachment acl-eotx5qsg#subnet-91x0geu6
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- tencentcloud tencentcloudstack/terraform-provider-tencentcloud
- License
- Notes
- This Pulumi package is based on the
tencentcloud
Terraform Provider.