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

tencentcloud.ClbSnatIp

Explore with Pulumi AI

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

    Provide a resource to create a SnatIp of CLB instance.

    NOTE: Target CLB instance must enable snat_pro before creating snat ips. NOTE: Dynamic allocate IP doesn’t support for now.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const snatTest = new tencentcloud.ClbInstance("snatTest", {
        networkType: "OPEN",
        clbName: "tf-clb-snat-test",
    });
    const foo = new tencentcloud.ClbSnatIp("foo", {
        clbId: snatTest.clbInstanceId,
        ips: [
            {
                subnetId: "subnet-12345678",
                ip: "172.16.0.1",
            },
            {
                subnetId: "subnet-12345678",
                ip: "172.16.0.2",
            },
        ],
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    snat_test = tencentcloud.ClbInstance("snatTest",
        network_type="OPEN",
        clb_name="tf-clb-snat-test")
    foo = tencentcloud.ClbSnatIp("foo",
        clb_id=snat_test.clb_instance_id,
        ips=[
            {
                "subnet_id": "subnet-12345678",
                "ip": "172.16.0.1",
            },
            {
                "subnet_id": "subnet-12345678",
                "ip": "172.16.0.2",
            },
        ])
    
    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 {
    		snatTest, err := tencentcloud.NewClbInstance(ctx, "snatTest", &tencentcloud.ClbInstanceArgs{
    			NetworkType: pulumi.String("OPEN"),
    			ClbName:     pulumi.String("tf-clb-snat-test"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewClbSnatIp(ctx, "foo", &tencentcloud.ClbSnatIpArgs{
    			ClbId: snatTest.ClbInstanceId,
    			Ips: tencentcloud.ClbSnatIpIpArray{
    				&tencentcloud.ClbSnatIpIpArgs{
    					SubnetId: pulumi.String("subnet-12345678"),
    					Ip:       pulumi.String("172.16.0.1"),
    				},
    				&tencentcloud.ClbSnatIpIpArgs{
    					SubnetId: pulumi.String("subnet-12345678"),
    					Ip:       pulumi.String("172.16.0.2"),
    				},
    			},
    		})
    		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 snatTest = new Tencentcloud.ClbInstance("snatTest", new()
        {
            NetworkType = "OPEN",
            ClbName = "tf-clb-snat-test",
        });
    
        var foo = new Tencentcloud.ClbSnatIp("foo", new()
        {
            ClbId = snatTest.ClbInstanceId,
            Ips = new[]
            {
                new Tencentcloud.Inputs.ClbSnatIpIpArgs
                {
                    SubnetId = "subnet-12345678",
                    Ip = "172.16.0.1",
                },
                new Tencentcloud.Inputs.ClbSnatIpIpArgs
                {
                    SubnetId = "subnet-12345678",
                    Ip = "172.16.0.2",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.ClbInstance;
    import com.pulumi.tencentcloud.ClbInstanceArgs;
    import com.pulumi.tencentcloud.ClbSnatIp;
    import com.pulumi.tencentcloud.ClbSnatIpArgs;
    import com.pulumi.tencentcloud.inputs.ClbSnatIpIpArgs;
    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) {
            var snatTest = new ClbInstance("snatTest", ClbInstanceArgs.builder()
                .networkType("OPEN")
                .clbName("tf-clb-snat-test")
                .build());
    
            var foo = new ClbSnatIp("foo", ClbSnatIpArgs.builder()
                .clbId(snatTest.clbInstanceId())
                .ips(            
                    ClbSnatIpIpArgs.builder()
                        .subnetId("subnet-12345678")
                        .ip("172.16.0.1")
                        .build(),
                    ClbSnatIpIpArgs.builder()
                        .subnetId("subnet-12345678")
                        .ip("172.16.0.2")
                        .build())
                .build());
    
        }
    }
    
    resources:
      snatTest:
        type: tencentcloud:ClbInstance
        properties:
          networkType: OPEN
          clbName: tf-clb-snat-test
      foo:
        type: tencentcloud:ClbSnatIp
        properties:
          clbId: ${snatTest.clbInstanceId}
          ips:
            - subnetId: subnet-12345678
              ip: 172.16.0.1
            - subnetId: subnet-12345678
              ip: 172.16.0.2
    

    Create ClbSnatIp Resource

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

    Constructor syntax

    new ClbSnatIp(name: string, args: ClbSnatIpArgs, opts?: CustomResourceOptions);
    @overload
    def ClbSnatIp(resource_name: str,
                  args: ClbSnatIpArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def ClbSnatIp(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  clb_id: Optional[str] = None,
                  clb_snat_ip_id: Optional[str] = None,
                  ips: Optional[Sequence[ClbSnatIpIpArgs]] = None)
    func NewClbSnatIp(ctx *Context, name string, args ClbSnatIpArgs, opts ...ResourceOption) (*ClbSnatIp, error)
    public ClbSnatIp(string name, ClbSnatIpArgs args, CustomResourceOptions? opts = null)
    public ClbSnatIp(String name, ClbSnatIpArgs args)
    public ClbSnatIp(String name, ClbSnatIpArgs args, CustomResourceOptions options)
    
    type: tencentcloud:ClbSnatIp
    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 ClbSnatIpArgs
    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 ClbSnatIpArgs
    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 ClbSnatIpArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ClbSnatIpArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ClbSnatIpArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    ClbId string
    CLB instance ID.
    ClbSnatIpId string
    ID of the resource.
    Ips List<ClbSnatIpIp>
    Snat IP address config.
    ClbId string
    CLB instance ID.
    ClbSnatIpId string
    ID of the resource.
    Ips []ClbSnatIpIpArgs
    Snat IP address config.
    clbId String
    CLB instance ID.
    clbSnatIpId String
    ID of the resource.
    ips List<ClbSnatIpIp>
    Snat IP address config.
    clbId string
    CLB instance ID.
    clbSnatIpId string
    ID of the resource.
    ips ClbSnatIpIp[]
    Snat IP address config.
    clb_id str
    CLB instance ID.
    clb_snat_ip_id str
    ID of the resource.
    ips Sequence[ClbSnatIpIpArgs]
    Snat IP address config.
    clbId String
    CLB instance ID.
    clbSnatIpId String
    ID of the resource.
    ips List<Property Map>
    Snat IP address config.

    Outputs

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

    Get an existing ClbSnatIp 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?: ClbSnatIpState, opts?: CustomResourceOptions): ClbSnatIp
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            clb_id: Optional[str] = None,
            clb_snat_ip_id: Optional[str] = None,
            ips: Optional[Sequence[ClbSnatIpIpArgs]] = None) -> ClbSnatIp
    func GetClbSnatIp(ctx *Context, name string, id IDInput, state *ClbSnatIpState, opts ...ResourceOption) (*ClbSnatIp, error)
    public static ClbSnatIp Get(string name, Input<string> id, ClbSnatIpState? state, CustomResourceOptions? opts = null)
    public static ClbSnatIp get(String name, Output<String> id, ClbSnatIpState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:ClbSnatIp    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:
    ClbId string
    CLB instance ID.
    ClbSnatIpId string
    ID of the resource.
    Ips List<ClbSnatIpIp>
    Snat IP address config.
    ClbId string
    CLB instance ID.
    ClbSnatIpId string
    ID of the resource.
    Ips []ClbSnatIpIpArgs
    Snat IP address config.
    clbId String
    CLB instance ID.
    clbSnatIpId String
    ID of the resource.
    ips List<ClbSnatIpIp>
    Snat IP address config.
    clbId string
    CLB instance ID.
    clbSnatIpId string
    ID of the resource.
    ips ClbSnatIpIp[]
    Snat IP address config.
    clb_id str
    CLB instance ID.
    clb_snat_ip_id str
    ID of the resource.
    ips Sequence[ClbSnatIpIpArgs]
    Snat IP address config.
    clbId String
    CLB instance ID.
    clbSnatIpId String
    ID of the resource.
    ips List<Property Map>
    Snat IP address config.

    Supporting Types

    ClbSnatIpIp, ClbSnatIpIpArgs

    Ip string
    Snat IP.
    SubnetId string
    Subnet ID.
    Ip string
    Snat IP.
    SubnetId string
    Subnet ID.
    ip String
    Snat IP.
    subnetId String
    Subnet ID.
    ip string
    Snat IP.
    subnetId string
    Subnet ID.
    ip str
    Snat IP.
    subnet_id str
    Subnet ID.
    ip String
    Snat IP.
    subnetId String
    Subnet ID.

    Import

    ClbSnatIp instance can be imported by clb instance id, e.g.

    $ pulumi import tencentcloud:index/clbSnatIp:ClbSnatIp test clb_id
    

    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.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack