1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. VpcBandwidthPackageAttachment
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.VpcBandwidthPackageAttachment

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a vpc bandwidth_package_attachment

    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 exampleVpcBandwidthPackage = new tencentcloud.VpcBandwidthPackage("exampleVpcBandwidthPackage", {
        networkType: "BGP",
        chargeType: "TOP5_POSTPAID_BY_MONTH",
        bandwidthPackageName: "tf-example",
        tags: {
            createdBy: "terraform",
        },
    });
    const exampleClbInstance = new tencentcloud.ClbInstance("exampleClbInstance", {
        networkType: "INTERNAL",
        clbName: "tf-example",
        projectId: 0,
        vpcId: vpc.vpcId,
        subnetId: subnet.subnetId,
        tags: {
            createdBy: "terraform",
        },
    });
    const attachment = new tencentcloud.VpcBandwidthPackageAttachment("attachment", {
        resourceId: exampleClbInstance.clbInstanceId,
        bandwidthPackageId: exampleVpcBandwidthPackage.vpcBandwidthPackageId,
        networkType: "BGP",
        resourceType: "LoadBalance",
    });
    
    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_vpc_bandwidth_package = tencentcloud.VpcBandwidthPackage("exampleVpcBandwidthPackage",
        network_type="BGP",
        charge_type="TOP5_POSTPAID_BY_MONTH",
        bandwidth_package_name="tf-example",
        tags={
            "createdBy": "terraform",
        })
    example_clb_instance = tencentcloud.ClbInstance("exampleClbInstance",
        network_type="INTERNAL",
        clb_name="tf-example",
        project_id=0,
        vpc_id=vpc.vpc_id,
        subnet_id=subnet.subnet_id,
        tags={
            "createdBy": "terraform",
        })
    attachment = tencentcloud.VpcBandwidthPackageAttachment("attachment",
        resource_id=example_clb_instance.clb_instance_id,
        bandwidth_package_id=example_vpc_bandwidth_package.vpc_bandwidth_package_id,
        network_type="BGP",
        resource_type="LoadBalance")
    
    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
    		}
    		exampleVpcBandwidthPackage, err := tencentcloud.NewVpcBandwidthPackage(ctx, "exampleVpcBandwidthPackage", &tencentcloud.VpcBandwidthPackageArgs{
    			NetworkType:          pulumi.String("BGP"),
    			ChargeType:           pulumi.String("TOP5_POSTPAID_BY_MONTH"),
    			BandwidthPackageName: pulumi.String("tf-example"),
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleClbInstance, err := tencentcloud.NewClbInstance(ctx, "exampleClbInstance", &tencentcloud.ClbInstanceArgs{
    			NetworkType: pulumi.String("INTERNAL"),
    			ClbName:     pulumi.String("tf-example"),
    			ProjectId:   pulumi.Float64(0),
    			VpcId:       vpc.VpcId,
    			SubnetId:    subnet.SubnetId,
    			Tags: pulumi.StringMap{
    				"createdBy": pulumi.String("terraform"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewVpcBandwidthPackageAttachment(ctx, "attachment", &tencentcloud.VpcBandwidthPackageAttachmentArgs{
    			ResourceId:         exampleClbInstance.ClbInstanceId,
    			BandwidthPackageId: exampleVpcBandwidthPackage.VpcBandwidthPackageId,
    			NetworkType:        pulumi.String("BGP"),
    			ResourceType:       pulumi.String("LoadBalance"),
    		})
    		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 exampleVpcBandwidthPackage = new Tencentcloud.VpcBandwidthPackage("exampleVpcBandwidthPackage", new()
        {
            NetworkType = "BGP",
            ChargeType = "TOP5_POSTPAID_BY_MONTH",
            BandwidthPackageName = "tf-example",
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
        var exampleClbInstance = new Tencentcloud.ClbInstance("exampleClbInstance", new()
        {
            NetworkType = "INTERNAL",
            ClbName = "tf-example",
            ProjectId = 0,
            VpcId = vpc.VpcId,
            SubnetId = subnet.SubnetId,
            Tags = 
            {
                { "createdBy", "terraform" },
            },
        });
    
        var attachment = new Tencentcloud.VpcBandwidthPackageAttachment("attachment", new()
        {
            ResourceId = exampleClbInstance.ClbInstanceId,
            BandwidthPackageId = exampleVpcBandwidthPackage.VpcBandwidthPackageId,
            NetworkType = "BGP",
            ResourceType = "LoadBalance",
        });
    
    });
    
    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.VpcBandwidthPackage;
    import com.pulumi.tencentcloud.VpcBandwidthPackageArgs;
    import com.pulumi.tencentcloud.ClbInstance;
    import com.pulumi.tencentcloud.ClbInstanceArgs;
    import com.pulumi.tencentcloud.VpcBandwidthPackageAttachment;
    import com.pulumi.tencentcloud.VpcBandwidthPackageAttachmentArgs;
    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 exampleVpcBandwidthPackage = new VpcBandwidthPackage("exampleVpcBandwidthPackage", VpcBandwidthPackageArgs.builder()
                .networkType("BGP")
                .chargeType("TOP5_POSTPAID_BY_MONTH")
                .bandwidthPackageName("tf-example")
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
            var exampleClbInstance = new ClbInstance("exampleClbInstance", ClbInstanceArgs.builder()
                .networkType("INTERNAL")
                .clbName("tf-example")
                .projectId(0)
                .vpcId(vpc.vpcId())
                .subnetId(subnet.subnetId())
                .tags(Map.of("createdBy", "terraform"))
                .build());
    
            var attachment = new VpcBandwidthPackageAttachment("attachment", VpcBandwidthPackageAttachmentArgs.builder()
                .resourceId(exampleClbInstance.clbInstanceId())
                .bandwidthPackageId(exampleVpcBandwidthPackage.vpcBandwidthPackageId())
                .networkType("BGP")
                .resourceType("LoadBalance")
                .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}
      exampleVpcBandwidthPackage:
        type: tencentcloud:VpcBandwidthPackage
        properties:
          networkType: BGP
          chargeType: TOP5_POSTPAID_BY_MONTH
          bandwidthPackageName: tf-example
          tags:
            createdBy: terraform
      exampleClbInstance:
        type: tencentcloud:ClbInstance
        properties:
          networkType: INTERNAL
          clbName: tf-example
          projectId: 0
          vpcId: ${vpc.vpcId}
          subnetId: ${subnet.subnetId}
          tags:
            createdBy: terraform
      attachment:
        type: tencentcloud:VpcBandwidthPackageAttachment
        properties:
          resourceId: ${exampleClbInstance.clbInstanceId}
          bandwidthPackageId: ${exampleVpcBandwidthPackage.vpcBandwidthPackageId}
          networkType: BGP
          resourceType: LoadBalance
    variables:
      zones:
        fn::invoke:
          function: tencentcloud:getAvailabilityZones
          arguments: {}
    

    Create VpcBandwidthPackageAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new VpcBandwidthPackageAttachment(name: string, args: VpcBandwidthPackageAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def VpcBandwidthPackageAttachment(resource_name: str,
                                      args: VpcBandwidthPackageAttachmentArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def VpcBandwidthPackageAttachment(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      bandwidth_package_id: Optional[str] = None,
                                      resource_id: Optional[str] = None,
                                      network_type: Optional[str] = None,
                                      protocol: Optional[str] = None,
                                      resource_type: Optional[str] = None,
                                      vpc_bandwidth_package_attachment_id: Optional[str] = None)
    func NewVpcBandwidthPackageAttachment(ctx *Context, name string, args VpcBandwidthPackageAttachmentArgs, opts ...ResourceOption) (*VpcBandwidthPackageAttachment, error)
    public VpcBandwidthPackageAttachment(string name, VpcBandwidthPackageAttachmentArgs args, CustomResourceOptions? opts = null)
    public VpcBandwidthPackageAttachment(String name, VpcBandwidthPackageAttachmentArgs args)
    public VpcBandwidthPackageAttachment(String name, VpcBandwidthPackageAttachmentArgs args, CustomResourceOptions options)
    
    type: tencentcloud:VpcBandwidthPackageAttachment
    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 VpcBandwidthPackageAttachmentArgs
    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 VpcBandwidthPackageAttachmentArgs
    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 VpcBandwidthPackageAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VpcBandwidthPackageAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VpcBandwidthPackageAttachmentArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    VpcBandwidthPackageAttachment 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 VpcBandwidthPackageAttachment resource accepts the following input properties:

    BandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    ResourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    NetworkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    Protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    ResourceType string
    Resource types, including Address, LoadBalance.
    VpcBandwidthPackageAttachmentId string
    ID of the resource.
    BandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    ResourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    NetworkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    Protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    ResourceType string
    Resource types, including Address, LoadBalance.
    VpcBandwidthPackageAttachmentId string
    ID of the resource.
    bandwidthPackageId String
    Bandwidth package unique ID, in the form of bwp-xxxx.
    resourceId String
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    networkType String
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol String
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceType String
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId String
    ID of the resource.
    bandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    resourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    networkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceType string
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId string
    ID of the resource.
    bandwidth_package_id str
    Bandwidth package unique ID, in the form of bwp-xxxx.
    resource_id str
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    network_type str
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol str
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resource_type str
    Resource types, including Address, LoadBalance.
    vpc_bandwidth_package_attachment_id str
    ID of the resource.
    bandwidthPackageId String
    Bandwidth package unique ID, in the form of bwp-xxxx.
    resourceId String
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    networkType String
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol String
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceType String
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId String
    ID of the resource.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the VpcBandwidthPackageAttachment 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 VpcBandwidthPackageAttachment Resource

    Get an existing VpcBandwidthPackageAttachment 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?: VpcBandwidthPackageAttachmentState, opts?: CustomResourceOptions): VpcBandwidthPackageAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            bandwidth_package_id: Optional[str] = None,
            network_type: Optional[str] = None,
            protocol: Optional[str] = None,
            resource_id: Optional[str] = None,
            resource_type: Optional[str] = None,
            vpc_bandwidth_package_attachment_id: Optional[str] = None) -> VpcBandwidthPackageAttachment
    func GetVpcBandwidthPackageAttachment(ctx *Context, name string, id IDInput, state *VpcBandwidthPackageAttachmentState, opts ...ResourceOption) (*VpcBandwidthPackageAttachment, error)
    public static VpcBandwidthPackageAttachment Get(string name, Input<string> id, VpcBandwidthPackageAttachmentState? state, CustomResourceOptions? opts = null)
    public static VpcBandwidthPackageAttachment get(String name, Output<String> id, VpcBandwidthPackageAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:VpcBandwidthPackageAttachment    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.
    The following state arguments are supported:
    BandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    NetworkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    Protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    ResourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    ResourceType string
    Resource types, including Address, LoadBalance.
    VpcBandwidthPackageAttachmentId string
    ID of the resource.
    BandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    NetworkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    Protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    ResourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    ResourceType string
    Resource types, including Address, LoadBalance.
    VpcBandwidthPackageAttachmentId string
    ID of the resource.
    bandwidthPackageId String
    Bandwidth package unique ID, in the form of bwp-xxxx.
    networkType String
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol String
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceId String
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    resourceType String
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId String
    ID of the resource.
    bandwidthPackageId string
    Bandwidth package unique ID, in the form of bwp-xxxx.
    networkType string
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol string
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceId string
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    resourceType string
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId string
    ID of the resource.
    bandwidth_package_id str
    Bandwidth package unique ID, in the form of bwp-xxxx.
    network_type str
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol str
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resource_id str
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    resource_type str
    Resource types, including Address, LoadBalance.
    vpc_bandwidth_package_attachment_id str
    ID of the resource.
    bandwidthPackageId String
    Bandwidth package unique ID, in the form of bwp-xxxx.
    networkType String
    Bandwidth packet type, currently supports BGP type, indicating that the internal resource is BGP IP.
    protocol String
    Bandwidth packet protocol type. Currently ipv4 and ipv6 protocol types are supported.
    resourceId String
    The unique ID of the resource, currently supports EIP resources and LB resources, such as eip-xxxx, lb-xxxx.
    resourceType String
    Resource types, including Address, LoadBalance.
    vpcBandwidthPackageAttachmentId String
    ID of the resource.

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack