1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. NatGatewaySnat
tencentcloud 1.81.183 published on Wednesday, Apr 16, 2025 by tencentcloudstack

tencentcloud.NatGatewaySnat

Explore with Pulumi AI

Provides a resource to create a NAT Gateway SNat rule.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";

const zones = tencentcloud.getAvailabilityZonesByProduct({
    product: "nat",
});
const image = tencentcloud.getImages({
    osName: "centos",
});
const instanceTypes = zones.then(zones => tencentcloud.getInstanceTypes({
    filters: [
        {
            name: "zone",
            values: [zones.zones?.[0]?.name],
        },
        {
            name: "instance-family",
            values: ["S5"],
        },
    ],
    cpuCoreCount: 2,
    excludeSoldOut: true,
}));
const vpc = new tencentcloud.Vpc("vpc", {cidrBlock: "10.0.0.0/16"});
// Create route_table and entry
const routeTable = new tencentcloud.RouteTable("routeTable", {vpcId: vpc.vpcId});
const subnet = new tencentcloud.Subnet("subnet", {
    vpcId: vpc.vpcId,
    cidrBlock: "10.0.0.0/16",
    availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
    routeTableId: routeTable.routeTableId,
});
const eipExample1 = new tencentcloud.Eip("eipExample1", {});
const eipExample2 = new tencentcloud.Eip("eipExample2", {});
// Create NAT Gateway
const myNat = new tencentcloud.NatGateway("myNat", {
    vpcId: vpc.vpcId,
    maxConcurrent: 3000000,
    bandwidth: 500,
    assignedEipSets: [
        eipExample1.publicIp,
        eipExample2.publicIp,
    ],
});
const routeEntry = new tencentcloud.RouteTableEntry("routeEntry", {
    routeTableId: routeTable.routeTableId,
    destinationCidrBlock: "10.0.0.0/8",
    nextType: "NAT",
    nextHub: myNat.natGatewayId,
});
// Subnet Nat gateway snat
const subnetSnat = new tencentcloud.NatGatewaySnat("subnetSnat", {
    natGatewayId: myNat.natGatewayId,
    resourceType: "SUBNET",
    subnetId: subnet.subnetId,
    subnetCidrBlock: subnet.cidrBlock,
    description: "terraform test",
    publicIpAddrs: [
        eipExample1.publicIp,
        eipExample2.publicIp,
    ],
});
// Create instance
const example = new tencentcloud.Instance("example", {
    instanceName: "tf_example",
    availabilityZone: zones.then(zones => zones.zones?.[0]?.name),
    imageId: image.then(image => image.images?.[0]?.imageId),
    instanceType: instanceTypes.then(instanceTypes => instanceTypes.instanceTypes?.[0]?.instanceType),
    systemDiskType: "CLOUD_PREMIUM",
    systemDiskSize: 50,
    hostname: "user",
    projectId: 0,
    vpcId: vpc.vpcId,
    subnetId: subnet.subnetId,
});
// NetWorkInterface Nat gateway snat
const myInstanceSnat = new tencentcloud.NatGatewaySnat("myInstanceSnat", {
    natGatewayId: myNat.natGatewayId,
    resourceType: "NETWORKINTERFACE",
    instanceId: example.instanceId,
    instancePrivateIpAddr: example.privateIp,
    description: "terraform test",
    publicIpAddrs: [eipExample1.publicIp],
});
Copy
import pulumi
import pulumi_tencentcloud as tencentcloud

zones = tencentcloud.get_availability_zones_by_product(product="nat")
image = tencentcloud.get_images(os_name="centos")
instance_types = tencentcloud.get_instance_types(filters=[
        {
            "name": "zone",
            "values": [zones.zones[0].name],
        },
        {
            "name": "instance-family",
            "values": ["S5"],
        },
    ],
    cpu_core_count=2,
    exclude_sold_out=True)
vpc = tencentcloud.Vpc("vpc", cidr_block="10.0.0.0/16")
# Create route_table and entry
route_table = tencentcloud.RouteTable("routeTable", vpc_id=vpc.vpc_id)
subnet = tencentcloud.Subnet("subnet",
    vpc_id=vpc.vpc_id,
    cidr_block="10.0.0.0/16",
    availability_zone=zones.zones[0].name,
    route_table_id=route_table.route_table_id)
eip_example1 = tencentcloud.Eip("eipExample1")
eip_example2 = tencentcloud.Eip("eipExample2")
# Create NAT Gateway
my_nat = tencentcloud.NatGateway("myNat",
    vpc_id=vpc.vpc_id,
    max_concurrent=3000000,
    bandwidth=500,
    assigned_eip_sets=[
        eip_example1.public_ip,
        eip_example2.public_ip,
    ])
route_entry = tencentcloud.RouteTableEntry("routeEntry",
    route_table_id=route_table.route_table_id,
    destination_cidr_block="10.0.0.0/8",
    next_type="NAT",
    next_hub=my_nat.nat_gateway_id)
# Subnet Nat gateway snat
subnet_snat = tencentcloud.NatGatewaySnat("subnetSnat",
    nat_gateway_id=my_nat.nat_gateway_id,
    resource_type="SUBNET",
    subnet_id=subnet.subnet_id,
    subnet_cidr_block=subnet.cidr_block,
    description="terraform test",
    public_ip_addrs=[
        eip_example1.public_ip,
        eip_example2.public_ip,
    ])
# Create instance
example = tencentcloud.Instance("example",
    instance_name="tf_example",
    availability_zone=zones.zones[0].name,
    image_id=image.images[0].image_id,
    instance_type=instance_types.instance_types[0].instance_type,
    system_disk_type="CLOUD_PREMIUM",
    system_disk_size=50,
    hostname="user",
    project_id=0,
    vpc_id=vpc.vpc_id,
    subnet_id=subnet.subnet_id)
# NetWorkInterface Nat gateway snat
my_instance_snat = tencentcloud.NatGatewaySnat("myInstanceSnat",
    nat_gateway_id=my_nat.nat_gateway_id,
    resource_type="NETWORKINTERFACE",
    instance_id=example.instance_id,
    instance_private_ip_addr=example.private_ip,
    description="terraform test",
    public_ip_addrs=[eip_example1.public_ip])
Copy
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.GetAvailabilityZonesByProduct(ctx, &tencentcloud.GetAvailabilityZonesByProductArgs{
Product: "nat",
}, nil);
if err != nil {
return err
}
image, err := tencentcloud.GetImages(ctx, &tencentcloud.GetImagesArgs{
OsName: pulumi.StringRef("centos"),
}, nil);
if err != nil {
return err
}
instanceTypes, err := tencentcloud.GetInstanceTypes(ctx, &tencentcloud.GetInstanceTypesArgs{
Filters: []tencentcloud.GetInstanceTypesFilter{
{
Name: "zone",
Values: interface{}{
zones.Zones[0].Name,
},
},
{
Name: "instance-family",
Values: []string{
"S5",
},
},
},
CpuCoreCount: pulumi.Float64Ref(2),
ExcludeSoldOut: pulumi.BoolRef(true),
}, 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
}
// Create route_table and entry
routeTable, err := tencentcloud.NewRouteTable(ctx, "routeTable", &tencentcloud.RouteTableArgs{
VpcId: vpc.VpcId,
})
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),
RouteTableId: routeTable.RouteTableId,
})
if err != nil {
return err
}
eipExample1, err := tencentcloud.NewEip(ctx, "eipExample1", nil)
if err != nil {
return err
}
eipExample2, err := tencentcloud.NewEip(ctx, "eipExample2", nil)
if err != nil {
return err
}
// Create NAT Gateway
myNat, err := tencentcloud.NewNatGateway(ctx, "myNat", &tencentcloud.NatGatewayArgs{
VpcId: vpc.VpcId,
MaxConcurrent: pulumi.Float64(3000000),
Bandwidth: pulumi.Float64(500),
AssignedEipSets: pulumi.StringArray{
eipExample1.PublicIp,
eipExample2.PublicIp,
},
})
if err != nil {
return err
}
_, err = tencentcloud.NewRouteTableEntry(ctx, "routeEntry", &tencentcloud.RouteTableEntryArgs{
RouteTableId: routeTable.RouteTableId,
DestinationCidrBlock: pulumi.String("10.0.0.0/8"),
NextType: pulumi.String("NAT"),
NextHub: myNat.NatGatewayId,
})
if err != nil {
return err
}
// Subnet Nat gateway snat
_, err = tencentcloud.NewNatGatewaySnat(ctx, "subnetSnat", &tencentcloud.NatGatewaySnatArgs{
NatGatewayId: myNat.NatGatewayId,
ResourceType: pulumi.String("SUBNET"),
SubnetId: subnet.SubnetId,
SubnetCidrBlock: subnet.CidrBlock,
Description: pulumi.String("terraform test"),
PublicIpAddrs: pulumi.StringArray{
eipExample1.PublicIp,
eipExample2.PublicIp,
},
})
if err != nil {
return err
}
// Create instance
example, err := tencentcloud.NewInstance(ctx, "example", &tencentcloud.InstanceArgs{
InstanceName: pulumi.String("tf_example"),
AvailabilityZone: pulumi.String(zones.Zones[0].Name),
ImageId: pulumi.String(image.Images[0].ImageId),
InstanceType: pulumi.String(instanceTypes.InstanceTypes[0].InstanceType),
SystemDiskType: pulumi.String("CLOUD_PREMIUM"),
SystemDiskSize: pulumi.Float64(50),
Hostname: pulumi.String("user"),
ProjectId: pulumi.Float64(0),
VpcId: vpc.VpcId,
SubnetId: subnet.SubnetId,
})
if err != nil {
return err
}
// NetWorkInterface Nat gateway snat
_, err = tencentcloud.NewNatGatewaySnat(ctx, "myInstanceSnat", &tencentcloud.NatGatewaySnatArgs{
NatGatewayId: myNat.NatGatewayId,
ResourceType: pulumi.String("NETWORKINTERFACE"),
InstanceId: example.InstanceId,
InstancePrivateIpAddr: example.PrivateIp,
Description: pulumi.String("terraform test"),
PublicIpAddrs: pulumi.StringArray{
eipExample1.PublicIp,
},
})
if err != nil {
return err
}
return nil
})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Tencentcloud = Pulumi.Tencentcloud;

return await Deployment.RunAsync(() => 
{
    var zones = Tencentcloud.GetAvailabilityZonesByProduct.Invoke(new()
    {
        Product = "nat",
    });

    var image = Tencentcloud.GetImages.Invoke(new()
    {
        OsName = "centos",
    });

    var instanceTypes = Tencentcloud.GetInstanceTypes.Invoke(new()
    {
        Filters = new[]
        {
            new Tencentcloud.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "zone",
                Values = new[]
                {
                    zones.Apply(getAvailabilityZonesByProductResult => getAvailabilityZonesByProductResult.Zones[0]?.Name),
                },
            },
            new Tencentcloud.Inputs.GetInstanceTypesFilterInputArgs
            {
                Name = "instance-family",
                Values = new[]
                {
                    "S5",
                },
            },
        },
        CpuCoreCount = 2,
        ExcludeSoldOut = true,
    });

    var vpc = new Tencentcloud.Vpc("vpc", new()
    {
        CidrBlock = "10.0.0.0/16",
    });

    // Create route_table and entry
    var routeTable = new Tencentcloud.RouteTable("routeTable", new()
    {
        VpcId = vpc.VpcId,
    });

    var subnet = new Tencentcloud.Subnet("subnet", new()
    {
        VpcId = vpc.VpcId,
        CidrBlock = "10.0.0.0/16",
        AvailabilityZone = zones.Apply(getAvailabilityZonesByProductResult => getAvailabilityZonesByProductResult.Zones[0]?.Name),
        RouteTableId = routeTable.RouteTableId,
    });

    var eipExample1 = new Tencentcloud.Eip("eipExample1");

    var eipExample2 = new Tencentcloud.Eip("eipExample2");

    // Create NAT Gateway
    var myNat = new Tencentcloud.NatGateway("myNat", new()
    {
        VpcId = vpc.VpcId,
        MaxConcurrent = 3000000,
        Bandwidth = 500,
        AssignedEipSets = new[]
        {
            eipExample1.PublicIp,
            eipExample2.PublicIp,
        },
    });

    var routeEntry = new Tencentcloud.RouteTableEntry("routeEntry", new()
    {
        RouteTableId = routeTable.RouteTableId,
        DestinationCidrBlock = "10.0.0.0/8",
        NextType = "NAT",
        NextHub = myNat.NatGatewayId,
    });

    // Subnet Nat gateway snat
    var subnetSnat = new Tencentcloud.NatGatewaySnat("subnetSnat", new()
    {
        NatGatewayId = myNat.NatGatewayId,
        ResourceType = "SUBNET",
        SubnetId = subnet.SubnetId,
        SubnetCidrBlock = subnet.CidrBlock,
        Description = "terraform test",
        PublicIpAddrs = new[]
        {
            eipExample1.PublicIp,
            eipExample2.PublicIp,
        },
    });

    // Create instance
    var example = new Tencentcloud.Instance("example", new()
    {
        InstanceName = "tf_example",
        AvailabilityZone = zones.Apply(getAvailabilityZonesByProductResult => getAvailabilityZonesByProductResult.Zones[0]?.Name),
        ImageId = image.Apply(getImagesResult => getImagesResult.Images[0]?.ImageId),
        InstanceType = instanceTypes.Apply(getInstanceTypesResult => getInstanceTypesResult.InstanceTypes[0]?.InstanceType),
        SystemDiskType = "CLOUD_PREMIUM",
        SystemDiskSize = 50,
        Hostname = "user",
        ProjectId = 0,
        VpcId = vpc.VpcId,
        SubnetId = subnet.SubnetId,
    });

    // NetWorkInterface Nat gateway snat
    var myInstanceSnat = new Tencentcloud.NatGatewaySnat("myInstanceSnat", new()
    {
        NatGatewayId = myNat.NatGatewayId,
        ResourceType = "NETWORKINTERFACE",
        InstanceId = example.InstanceId,
        InstancePrivateIpAddr = example.PrivateIp,
        Description = "terraform test",
        PublicIpAddrs = new[]
        {
            eipExample1.PublicIp,
        },
    });

});
Copy
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.GetAvailabilityZonesByProductArgs;
import com.pulumi.tencentcloud.inputs.GetImagesArgs;
import com.pulumi.tencentcloud.inputs.GetInstanceTypesArgs;
import com.pulumi.tencentcloud.Vpc;
import com.pulumi.tencentcloud.VpcArgs;
import com.pulumi.tencentcloud.RouteTable;
import com.pulumi.tencentcloud.RouteTableArgs;
import com.pulumi.tencentcloud.Subnet;
import com.pulumi.tencentcloud.SubnetArgs;
import com.pulumi.tencentcloud.Eip;
import com.pulumi.tencentcloud.NatGateway;
import com.pulumi.tencentcloud.NatGatewayArgs;
import com.pulumi.tencentcloud.RouteTableEntry;
import com.pulumi.tencentcloud.RouteTableEntryArgs;
import com.pulumi.tencentcloud.NatGatewaySnat;
import com.pulumi.tencentcloud.NatGatewaySnatArgs;
import com.pulumi.tencentcloud.Instance;
import com.pulumi.tencentcloud.InstanceArgs;
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.getAvailabilityZonesByProduct(GetAvailabilityZonesByProductArgs.builder()
            .product("nat")
            .build());

        final var image = TencentcloudFunctions.getImages(GetImagesArgs.builder()
            .osName("centos")
            .build());

        final var instanceTypes = TencentcloudFunctions.getInstanceTypes(GetInstanceTypesArgs.builder()
            .filters(            
                GetInstanceTypesFilterArgs.builder()
                    .name("zone")
                    .values(zones.applyValue(getAvailabilityZonesByProductResult -> getAvailabilityZonesByProductResult.zones()[0].name()))
                    .build(),
                GetInstanceTypesFilterArgs.builder()
                    .name("instance-family")
                    .values("S5")
                    .build())
            .cpuCoreCount(2)
            .excludeSoldOut(true)
            .build());

        var vpc = new Vpc("vpc", VpcArgs.builder()
            .cidrBlock("10.0.0.0/16")
            .build());

        // Create route_table and entry
        var routeTable = new RouteTable("routeTable", RouteTableArgs.builder()
            .vpcId(vpc.vpcId())
            .build());

        var subnet = new Subnet("subnet", SubnetArgs.builder()
            .vpcId(vpc.vpcId())
            .cidrBlock("10.0.0.0/16")
            .availabilityZone(zones.applyValue(getAvailabilityZonesByProductResult -> getAvailabilityZonesByProductResult.zones()[0].name()))
            .routeTableId(routeTable.routeTableId())
            .build());

        var eipExample1 = new Eip("eipExample1");

        var eipExample2 = new Eip("eipExample2");

        // Create NAT Gateway
        var myNat = new NatGateway("myNat", NatGatewayArgs.builder()
            .vpcId(vpc.vpcId())
            .maxConcurrent(3000000)
            .bandwidth(500)
            .assignedEipSets(            
                eipExample1.publicIp(),
                eipExample2.publicIp())
            .build());

        var routeEntry = new RouteTableEntry("routeEntry", RouteTableEntryArgs.builder()
            .routeTableId(routeTable.routeTableId())
            .destinationCidrBlock("10.0.0.0/8")
            .nextType("NAT")
            .nextHub(myNat.natGatewayId())
            .build());

        // Subnet Nat gateway snat
        var subnetSnat = new NatGatewaySnat("subnetSnat", NatGatewaySnatArgs.builder()
            .natGatewayId(myNat.natGatewayId())
            .resourceType("SUBNET")
            .subnetId(subnet.subnetId())
            .subnetCidrBlock(subnet.cidrBlock())
            .description("terraform test")
            .publicIpAddrs(            
                eipExample1.publicIp(),
                eipExample2.publicIp())
            .build());

        // Create instance
        var example = new Instance("example", InstanceArgs.builder()
            .instanceName("tf_example")
            .availabilityZone(zones.applyValue(getAvailabilityZonesByProductResult -> getAvailabilityZonesByProductResult.zones()[0].name()))
            .imageId(image.applyValue(getImagesResult -> getImagesResult.images()[0].imageId()))
            .instanceType(instanceTypes.applyValue(getInstanceTypesResult -> getInstanceTypesResult.instanceTypes()[0].instanceType()))
            .systemDiskType("CLOUD_PREMIUM")
            .systemDiskSize(50)
            .hostname("user")
            .projectId(0)
            .vpcId(vpc.vpcId())
            .subnetId(subnet.subnetId())
            .build());

        // NetWorkInterface Nat gateway snat
        var myInstanceSnat = new NatGatewaySnat("myInstanceSnat", NatGatewaySnatArgs.builder()
            .natGatewayId(myNat.natGatewayId())
            .resourceType("NETWORKINTERFACE")
            .instanceId(example.instanceId())
            .instancePrivateIpAddr(example.privateIp())
            .description("terraform test")
            .publicIpAddrs(eipExample1.publicIp())
            .build());

    }
}
Copy
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}
      routeTableId: ${routeTable.routeTableId}
  eipExample1:
    type: tencentcloud:Eip
  eipExample2:
    type: tencentcloud:Eip
  # Create NAT Gateway
  myNat:
    type: tencentcloud:NatGateway
    properties:
      vpcId: ${vpc.vpcId}
      maxConcurrent: 3e+06
      bandwidth: 500
      assignedEipSets:
        - ${eipExample1.publicIp}
        - ${eipExample2.publicIp}
  # Create route_table and entry
  routeTable:
    type: tencentcloud:RouteTable
    properties:
      vpcId: ${vpc.vpcId}
  routeEntry:
    type: tencentcloud:RouteTableEntry
    properties:
      routeTableId: ${routeTable.routeTableId}
      destinationCidrBlock: 10.0.0.0/8
      nextType: NAT
      nextHub: ${myNat.natGatewayId}
  # Subnet Nat gateway snat
  subnetSnat:
    type: tencentcloud:NatGatewaySnat
    properties:
      natGatewayId: ${myNat.natGatewayId}
      resourceType: SUBNET
      subnetId: ${subnet.subnetId}
      subnetCidrBlock: ${subnet.cidrBlock}
      description: terraform test
      publicIpAddrs:
        - ${eipExample1.publicIp}
        - ${eipExample2.publicIp}
  # Create instance
  example:
    type: tencentcloud:Instance
    properties:
      instanceName: tf_example
      availabilityZone: ${zones.zones[0].name}
      imageId: ${image.images[0].imageId}
      instanceType: ${instanceTypes.instanceTypes[0].instanceType}
      systemDiskType: CLOUD_PREMIUM
      systemDiskSize: 50
      hostname: user
      projectId: 0
      vpcId: ${vpc.vpcId}
      subnetId: ${subnet.subnetId}
  # NetWorkInterface Nat gateway snat
  myInstanceSnat:
    type: tencentcloud:NatGatewaySnat
    properties:
      natGatewayId: ${myNat.natGatewayId}
      resourceType: NETWORKINTERFACE
      instanceId: ${example.instanceId}
      instancePrivateIpAddr: ${example.privateIp}
      description: terraform test
      publicIpAddrs:
        - ${eipExample1.publicIp}
variables:
  zones:
    fn::invoke:
      function: tencentcloud:getAvailabilityZonesByProduct
      arguments:
        product: nat
  image:
    fn::invoke:
      function: tencentcloud:getImages
      arguments:
        osName: centos
  instanceTypes:
    fn::invoke:
      function: tencentcloud:getInstanceTypes
      arguments:
        filters:
          - name: zone
            values:
              - ${zones.zones[0].name}
          - name: instance-family
            values:
              - S5
        cpuCoreCount: 2
        excludeSoldOut: true
Copy

Create NatGatewaySnat Resource

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

Constructor syntax

new NatGatewaySnat(name: string, args: NatGatewaySnatArgs, opts?: CustomResourceOptions);
@overload
def NatGatewaySnat(resource_name: str,
                   args: NatGatewaySnatArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def NatGatewaySnat(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   description: Optional[str] = None,
                   nat_gateway_id: Optional[str] = None,
                   public_ip_addrs: Optional[Sequence[str]] = None,
                   resource_type: Optional[str] = None,
                   instance_id: Optional[str] = None,
                   instance_private_ip_addr: Optional[str] = None,
                   nat_gateway_snat_id: Optional[str] = None,
                   subnet_cidr_block: Optional[str] = None,
                   subnet_id: Optional[str] = None)
func NewNatGatewaySnat(ctx *Context, name string, args NatGatewaySnatArgs, opts ...ResourceOption) (*NatGatewaySnat, error)
public NatGatewaySnat(string name, NatGatewaySnatArgs args, CustomResourceOptions? opts = null)
public NatGatewaySnat(String name, NatGatewaySnatArgs args)
public NatGatewaySnat(String name, NatGatewaySnatArgs args, CustomResourceOptions options)
type: tencentcloud:NatGatewaySnat
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NatGatewaySnatArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. NatGatewaySnatArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. NatGatewaySnatArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NatGatewaySnatArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. NatGatewaySnatArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

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

Description This property is required. string
Description.
NatGatewayId This property is required. string
NAT gateway ID.
PublicIpAddrs This property is required. List<string>
Elastic IP address pool.
ResourceType This property is required. string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
InstanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
InstancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
NatGatewaySnatId string
ID of the resource.
SubnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
SubnetId string
Subnet instance ID, required when resource_type is SUBNET.
Description This property is required. string
Description.
NatGatewayId This property is required. string
NAT gateway ID.
PublicIpAddrs This property is required. []string
Elastic IP address pool.
ResourceType This property is required. string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
InstanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
InstancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
NatGatewaySnatId string
ID of the resource.
SubnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
SubnetId string
Subnet instance ID, required when resource_type is SUBNET.
description This property is required. String
Description.
natGatewayId This property is required. String
NAT gateway ID.
publicIpAddrs This property is required. List<String>
Elastic IP address pool.
resourceType This property is required. String
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
instanceId String
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr String
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewaySnatId String
ID of the resource.
subnetCidrBlock String
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId String
Subnet instance ID, required when resource_type is SUBNET.
description This property is required. string
Description.
natGatewayId This property is required. string
NAT gateway ID.
publicIpAddrs This property is required. string[]
Elastic IP address pool.
resourceType This property is required. string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
instanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewaySnatId string
ID of the resource.
subnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId string
Subnet instance ID, required when resource_type is SUBNET.
description This property is required. str
Description.
nat_gateway_id This property is required. str
NAT gateway ID.
public_ip_addrs This property is required. Sequence[str]
Elastic IP address pool.
resource_type This property is required. str
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
instance_id str
Instance ID, required when resource_type is NETWORKINTERFACE.
instance_private_ip_addr str
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
nat_gateway_snat_id str
ID of the resource.
subnet_cidr_block str
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnet_id str
Subnet instance ID, required when resource_type is SUBNET.
description This property is required. String
Description.
natGatewayId This property is required. String
NAT gateway ID.
publicIpAddrs This property is required. List<String>
Elastic IP address pool.
resourceType This property is required. String
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
instanceId String
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr String
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewaySnatId String
ID of the resource.
subnetCidrBlock String
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId String
Subnet instance ID, required when resource_type is SUBNET.

Outputs

All input properties are implicitly available as output properties. Additionally, the NatGatewaySnat resource produces the following output properties:

CreateTime string
Create time.
Id string
The provider-assigned unique ID for this managed resource.
SnatId string
SNAT rule ID.
CreateTime string
Create time.
Id string
The provider-assigned unique ID for this managed resource.
SnatId string
SNAT rule ID.
createTime String
Create time.
id String
The provider-assigned unique ID for this managed resource.
snatId String
SNAT rule ID.
createTime string
Create time.
id string
The provider-assigned unique ID for this managed resource.
snatId string
SNAT rule ID.
create_time str
Create time.
id str
The provider-assigned unique ID for this managed resource.
snat_id str
SNAT rule ID.
createTime String
Create time.
id String
The provider-assigned unique ID for this managed resource.
snatId String
SNAT rule ID.

Look up Existing NatGatewaySnat Resource

Get an existing NatGatewaySnat 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?: NatGatewaySnatState, opts?: CustomResourceOptions): NatGatewaySnat
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        create_time: Optional[str] = None,
        description: Optional[str] = None,
        instance_id: Optional[str] = None,
        instance_private_ip_addr: Optional[str] = None,
        nat_gateway_id: Optional[str] = None,
        nat_gateway_snat_id: Optional[str] = None,
        public_ip_addrs: Optional[Sequence[str]] = None,
        resource_type: Optional[str] = None,
        snat_id: Optional[str] = None,
        subnet_cidr_block: Optional[str] = None,
        subnet_id: Optional[str] = None) -> NatGatewaySnat
func GetNatGatewaySnat(ctx *Context, name string, id IDInput, state *NatGatewaySnatState, opts ...ResourceOption) (*NatGatewaySnat, error)
public static NatGatewaySnat Get(string name, Input<string> id, NatGatewaySnatState? state, CustomResourceOptions? opts = null)
public static NatGatewaySnat get(String name, Output<String> id, NatGatewaySnatState state, CustomResourceOptions options)
resources:  _:    type: tencentcloud:NatGatewaySnat    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
CreateTime string
Create time.
Description string
Description.
InstanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
InstancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
NatGatewayId string
NAT gateway ID.
NatGatewaySnatId string
ID of the resource.
PublicIpAddrs List<string>
Elastic IP address pool.
ResourceType string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
SnatId string
SNAT rule ID.
SubnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
SubnetId string
Subnet instance ID, required when resource_type is SUBNET.
CreateTime string
Create time.
Description string
Description.
InstanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
InstancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
NatGatewayId string
NAT gateway ID.
NatGatewaySnatId string
ID of the resource.
PublicIpAddrs []string
Elastic IP address pool.
ResourceType string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
SnatId string
SNAT rule ID.
SubnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
SubnetId string
Subnet instance ID, required when resource_type is SUBNET.
createTime String
Create time.
description String
Description.
instanceId String
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr String
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewayId String
NAT gateway ID.
natGatewaySnatId String
ID of the resource.
publicIpAddrs List<String>
Elastic IP address pool.
resourceType String
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
snatId String
SNAT rule ID.
subnetCidrBlock String
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId String
Subnet instance ID, required when resource_type is SUBNET.
createTime string
Create time.
description string
Description.
instanceId string
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr string
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewayId string
NAT gateway ID.
natGatewaySnatId string
ID of the resource.
publicIpAddrs string[]
Elastic IP address pool.
resourceType string
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
snatId string
SNAT rule ID.
subnetCidrBlock string
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId string
Subnet instance ID, required when resource_type is SUBNET.
create_time str
Create time.
description str
Description.
instance_id str
Instance ID, required when resource_type is NETWORKINTERFACE.
instance_private_ip_addr str
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
nat_gateway_id str
NAT gateway ID.
nat_gateway_snat_id str
ID of the resource.
public_ip_addrs Sequence[str]
Elastic IP address pool.
resource_type str
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
snat_id str
SNAT rule ID.
subnet_cidr_block str
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnet_id str
Subnet instance ID, required when resource_type is SUBNET.
createTime String
Create time.
description String
Description.
instanceId String
Instance ID, required when resource_type is NETWORKINTERFACE.
instancePrivateIpAddr String
Private IPs of the instance's primary ENI, required when resource_type is NETWORKINTERFACE.
natGatewayId String
NAT gateway ID.
natGatewaySnatId String
ID of the resource.
publicIpAddrs List<String>
Elastic IP address pool.
resourceType String
Resource type. Valid values: SUBNET, NETWORKINTERFACE.
snatId String
SNAT rule ID.
subnetCidrBlock String
The IPv4 CIDR of the subnet, required when resource_type is SUBNET.
subnetId String
Subnet instance ID, required when resource_type is SUBNET.

Import

VPN gateway route can be imported using the id, the id format must be ‘{nat_gateway_id}#{resource_id}’, resource_id range subnet_id, instance_id, e.g.

SUBNET SNat

$ pulumi import tencentcloud:index/natGatewaySnat:NatGatewaySnat my_snat nat-r4ip1cwt#subnet-2ap74y35
Copy

NETWORKINTERFACT SNat

$ pulumi import tencentcloud:index/natGatewaySnat:NatGatewaySnat my_snat nat-r4ip1cwt#ins-da412f5a
Copy

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.