GetNatGateways

This data source provides a list of Nat Gateways 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") ?? "natGatewaysDatasource";
        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 fooNatGateway = new AliCloud.Vpc.NatGateway("fooNatGateway", new AliCloud.Vpc.NatGatewayArgs
        {
            Specification = "Small",
            VpcId = fooNetwork.Id,
        });
        var fooNatGateways = Output.Tuple(fooNatGateway.Id, fooNatGateway.Name, fooNetwork.Id).Apply(values =>
        {
            var fooNatGatewayId = values.Item1;
            var name = values.Item2;
            var fooNetworkId = values.Item3;
            return AliCloud.Vpc.GetNatGateways.InvokeAsync(new AliCloud.Vpc.GetNatGatewaysArgs
            {
                Ids = 
                {
                    fooNatGatewayId,
                },
                NameRegex = name,
                VpcId = fooNetworkId,
            });
        });
    }

}

Coming soon!

import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "natGatewaysDatasource"
default = alicloud.get_zones(available_resource_creation="VSwitch")
foo_network = alicloud.vpc.Network("fooNetwork", cidr_block="172.16.0.0/12")
foo_nat_gateway = alicloud.vpc.NatGateway("fooNatGateway",
    specification="Small",
    vpc_id=foo_network.id)
foo_nat_gateways = pulumi.Output.all(foo_nat_gateway.id, foo_nat_gateway.name, foo_network.id).apply(lambda fooNatGatewayId, name, fooNetworkId: alicloud.vpc.get_nat_gateways(ids=[foo_nat_gateway_id],
    name_regex=name,
    vpc_id=foo_network_id))
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "natGatewaysDatasource";

const defaultZones = pulumi.output(alicloud.getZones({
    availableResourceCreation: "VSwitch",
}, { async: true }));
const fooNetwork = new alicloud.vpc.Network("foo", {
    cidrBlock: "172.16.0.0/12",
});
const fooNatGateway = new alicloud.vpc.NatGateway("foo", {
    specification: "Small",
    vpcId: fooNetwork.id,
});
const fooNatGateways = pulumi.all([fooNatGateway.id, fooNatGateway.name, fooNetwork.id]).apply(([fooNatGatewayId, name, fooNetworkId]) => alicloud.vpc.getNatGateways({
    ids: [fooNatGatewayId],
    nameRegex: name,
    vpcId: fooNetworkId,
}, { async: true }));

Using GetNatGateways

function getNatGateways(args: GetNatGatewaysArgs, opts?: InvokeOptions): Promise<GetNatGatewaysResult>
function  get_nat_gateways(ids=None, name_regex=None, output_file=None, vpc_id=None, opts=None)
func GetNatGateways(ctx *Context, args *GetNatGatewaysArgs, opts ...InvokeOption) (*GetNatGatewaysResult, error)
public static class GetNatGateways {
    public static Task<GetNatGatewaysResult> InvokeAsync(GetNatGatewaysArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

Ids List<string>

A list of NAT gateways IDs.

NameRegex string

A regex string to filter nat gateways by name.

OutputFile string
VpcId string

The ID of the VPC.

Ids []string

A list of NAT gateways IDs.

NameRegex string

A regex string to filter nat gateways by name.

OutputFile string
VpcId string

The ID of the VPC.

ids string[]

A list of NAT gateways IDs.

nameRegex string

A regex string to filter nat gateways by name.

outputFile string
vpcId string

The ID of the VPC.

ids List[str]

A list of NAT gateways IDs.

name_regex str

A regex string to filter nat gateways by name.

output_file str
vpc_id str

The ID of the VPC.

GetNatGateways Result

The following output properties are available:

Gateways List<Pulumi.AliCloud.Vpc.Outputs.GetNatGatewaysGateway>

A list of Nat gateways. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>

(Optional) A list of Nat gateways IDs.

Names List<string>

A list of Nat gateways names.

NameRegex string
OutputFile string
VpcId string

The ID of the VPC.

Gateways []GetNatGatewaysGateway

A list of Nat gateways. Each element contains the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

Ids []string

(Optional) A list of Nat gateways IDs.

Names []string

A list of Nat gateways names.

NameRegex string
OutputFile string
VpcId string

The ID of the VPC.

gateways GetNatGatewaysGateway[]

A list of Nat gateways. Each element contains the following attributes:

id string

The provider-assigned unique ID for this managed resource.

ids string[]

(Optional) A list of Nat gateways IDs.

names string[]

A list of Nat gateways names.

nameRegex string
outputFile string
vpcId string

The ID of the VPC.

gateways List[GetNatGatewaysGateway]

A list of Nat gateways. Each element contains the following attributes:

id str

The provider-assigned unique ID for this managed resource.

ids List[str]

(Optional) A list of Nat gateways IDs.

names List[str]

A list of Nat gateways names.

name_regex str
output_file str
vpc_id str

The ID of the VPC.

Supporting Types

GetNatGatewaysGateway

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

CreationTime string

Time of creation.

Description string

The description of the NAT gateway.

ForwardTableId string

The forward table id.

Id string

The ID of the NAT gateway.

Name string

Name of the NAT gateway.

SnatTableId string

The snat table id.

Spec string

The specification of the NAT gateway.

Status string

The status of the NAT gateway.

VpcId string

The ID of the VPC.

CreationTime string

Time of creation.

Description string

The description of the NAT gateway.

ForwardTableId string

The forward table id.

Id string

The ID of the NAT gateway.

Name string

Name of the NAT gateway.

SnatTableId string

The snat table id.

Spec string

The specification of the NAT gateway.

Status string

The status of the NAT gateway.

VpcId string

The ID of the VPC.

creationTime string

Time of creation.

description string

The description of the NAT gateway.

forwardTableId string

The forward table id.

id string

The ID of the NAT gateway.

name string

Name of the NAT gateway.

snatTableId string

The snat table id.

spec string

The specification of the NAT gateway.

status string

The status of the NAT gateway.

vpcId string

The ID of the VPC.

creation_time str

Time of creation.

description str

The description of the NAT gateway.

forward_table_id str

The forward table id.

id str

The ID of the NAT gateway.

name str

Name of the NAT gateway.

snat_table_id str

The snat table id.

spec str

The specification of the NAT gateway.

status str

The status of the NAT gateway.

vpc_id str

The ID of the VPC.

Package Details

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