GetSnatEntries

This data source provides a list of Snat Entries owned by an Alibaba Cloud account.

NOTE: Available in 1.37.0+.

Example Usage

using Pulumi;
using AliCloud = Pulumi.AliCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var name = config.Get("name") ?? "snat-entry-example-name";
        var @default = Output.Create(AliCloud.GetZones.InvokeAsync(new AliCloud.GetZonesArgs
        {
            AvailableResourceCreation = "VSwitch",
        }));
        var fooNetwork = new AliCloud.Vpc.Network("fooNetwork", new AliCloud.Vpc.NetworkArgs
        {
            CidrBlock = "172.16.0.0/12",
        });
        var fooSwitch = new AliCloud.Vpc.Switch("fooSwitch", new AliCloud.Vpc.SwitchArgs
        {
            AvailabilityZone = @default.Apply(@default => @default.Zones[0].Id),
            CidrBlock = "172.16.0.0/21",
            VpcId = fooNetwork.Id,
        });
        var fooNatGateway = new AliCloud.Vpc.NatGateway("fooNatGateway", new AliCloud.Vpc.NatGatewayArgs
        {
            Specification = "Small",
            VpcId = fooNetwork.Id,
        });
        var fooEip = new AliCloud.Ecs.Eip("fooEip", new AliCloud.Ecs.EipArgs
        {
        });
        var fooEipAssociation = new AliCloud.Ecs.EipAssociation("fooEipAssociation", new AliCloud.Ecs.EipAssociationArgs
        {
            AllocationId = fooEip.Id,
            InstanceId = fooNatGateway.Id,
        });
        var fooSnatEntry = new AliCloud.Vpc.SnatEntry("fooSnatEntry", new AliCloud.Vpc.SnatEntryArgs
        {
            SnatIp = fooEip.IpAddress,
            SnatTableId = fooNatGateway.SnatTableIds,
            SourceVswitchId = fooSwitch.Id,
        });
        var fooSnatEntries = fooSnatEntry.SnatTableId.Apply(snatTableId => AliCloud.Vpc.GetSnatEntries.InvokeAsync(new AliCloud.Vpc.GetSnatEntriesArgs
        {
            SnatTableId = snatTableId,
        }));
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "snat-entry-example-name"
default = alicloud.get_zones(available_resource_creation="VSwitch")
foo_network = alicloud.vpc.Network("fooNetwork", cidr_block="172.16.0.0/12")
foo_switch = alicloud.vpc.Switch("fooSwitch",
    availability_zone=default.zones[0]["id"],
    cidr_block="172.16.0.0/21",
    vpc_id=foo_network.id)
foo_nat_gateway = alicloud.vpc.NatGateway("fooNatGateway",
    specification="Small",
    vpc_id=foo_network.id)
foo_eip = alicloud.ecs.Eip("fooEip")
foo_eip_association = alicloud.ecs.EipAssociation("fooEipAssociation",
    allocation_id=foo_eip.id,
    instance_id=foo_nat_gateway.id)
foo_snat_entry = alicloud.vpc.SnatEntry("fooSnatEntry",
    snat_ip=foo_eip.ip_address,
    snat_table_id=foo_nat_gateway.snat_table_ids,
    source_vswitch_id=foo_switch.id)
foo_snat_entries = foo_snat_entry.snat_table_id.apply(lambda snat_table_id: alicloud.vpc.get_snat_entries(snat_table_id=snat_table_id))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "snat-entry-example-name";

const defaultZones = pulumi.output(alicloud.getZones({
    availableResourceCreation: "VSwitch",
}, { async: true }));
const fooNetwork = new alicloud.vpc.Network("foo", {
    cidrBlock: "172.16.0.0/12",
});
const fooSwitch = new alicloud.vpc.Switch("foo", {
    availabilityZone: defaultZones.zones[0].id,
    cidrBlock: "172.16.0.0/21",
    vpcId: fooNetwork.id,
});
const fooNatGateway = new alicloud.vpc.NatGateway("foo", {
    specification: "Small",
    vpcId: fooNetwork.id,
});
const fooEip = new alicloud.ecs.Eip("foo", {});
const fooEipAssociation = new alicloud.ecs.EipAssociation("foo", {
    allocationId: fooEip.id,
    instanceId: fooNatGateway.id,
});
const fooSnatEntry = new alicloud.vpc.SnatEntry("foo", {
    snatIp: fooEip.ipAddress,
    snatTableId: fooNatGateway.snatTableIds,
    sourceVswitchId: fooSwitch.id,
});
const fooSnatEntries = fooSnatEntry.snatTableId.apply(snatTableId => alicloud.vpc.getSnatEntries({
    snatTableId: snatTableId,
}, { async: true }));

Using GetSnatEntries

function getSnatEntries(args: GetSnatEntriesArgs, opts?: InvokeOptions): Promise<GetSnatEntriesResult>
function  get_snat_entries(ids=None, output_file=None, snat_ip=None, snat_table_id=None, source_cidr=None, opts=None)
func GetSnatEntries(ctx *Context, args *GetSnatEntriesArgs, opts ...InvokeOption) (*GetSnatEntriesResult, error)
public static class GetSnatEntries {
    public static Task<GetSnatEntriesResult> InvokeAsync(GetSnatEntriesArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

SnatTableId string

The ID of the Snat table.

Ids List<string>

A list of Snat Entries IDs.

OutputFile string
SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

SnatTableId string

The ID of the Snat table.

Ids []string

A list of Snat Entries IDs.

OutputFile string
SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

snatTableId string

The ID of the Snat table.

ids string[]

A list of Snat Entries IDs.

outputFile string
snatIp string

The public IP of the Snat Entry.

sourceCidr string

The source CIDR block of the Snat Entry.

snat_table_id str

The ID of the Snat table.

ids List[str]

A list of Snat Entries IDs.

output_file str
snat_ip str

The public IP of the Snat Entry.

source_cidr str

The source CIDR block of the Snat Entry.

GetSnatEntries Result

The following output properties are available:

Entries List<Pulumi.AliCloud.Vpc.Outputs.GetSnatEntriesEntry>

A list of Snat Entries. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

(Optional) A list of Snat Entries IDs.

SnatTableId string
OutputFile string
SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

Entries []GetSnatEntriesEntry

A list of Snat Entries. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

(Optional) A list of Snat Entries IDs.

SnatTableId string
OutputFile string
SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

entries GetSnatEntriesEntry[]

A list of Snat Entries. Each element contains the following attributes:

id string

The provider-assigned unique ID for this managed resource.

ids string[]

(Optional) A list of Snat Entries IDs.

snatTableId string
outputFile string
snatIp string

The public IP of the Snat Entry.

sourceCidr string

The source CIDR block of the Snat Entry.

entries List[GetSnatEntriesEntry]

A list of Snat Entries. Each element contains the following attributes:

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

(Optional) A list of Snat Entries IDs.

snat_table_id str
output_file str
snat_ip str

The public IP of the Snat Entry.

source_cidr str

The source CIDR block of the Snat Entry.

Supporting Types

GetSnatEntriesEntry

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Id string

The ID of the Snat Entry.

SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

Status string

The status of the Snat Entry.

Id string

The ID of the Snat Entry.

SnatIp string

The public IP of the Snat Entry.

SourceCidr string

The source CIDR block of the Snat Entry.

Status string

The status of the Snat Entry.

id string

The ID of the Snat Entry.

snatIp string

The public IP of the Snat Entry.

sourceCidr string

The source CIDR block of the Snat Entry.

status string

The status of the Snat Entry.

id str

The ID of the Snat Entry.

snat_ip str

The public IP of the Snat Entry.

source_cidr str

The source CIDR block of the Snat Entry.

status str

The status of the Snat Entry.

Package Details

Repository
https://github.com/pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.