alicloud logo
Alibaba Cloud v3.34.0, Mar 17 23

alicloud.vpc.getNatIps

This data source provides the Vpc Nat Ips of the current Alibaba Cloud user.

NOTE: Available in v1.136.0+.

Example Usage

Basic Usage

using System.Collections.Generic;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var ids = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        Ids = new[]
        {
            "example_value-1",
            "example_value-2",
        },
    });

    var nameRegex = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        NameRegex = "^my-NatIp",
    });

    var natIpCidr = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        NatIpCidr = "example_value",
        NameRegex = "^my-NatIp",
    });

    var natIpName = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        Ids = new[]
        {
            "example_value",
        },
        NatIpNames = new[]
        {
            "example_value",
        },
    });

    var natIpIds = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        Ids = new[]
        {
            "example_value",
        },
        NatIpIds = new[]
        {
            "example_value",
        },
    });

    var status = AliCloud.Vpc.GetNatIps.Invoke(new()
    {
        NatGatewayId = "example_value",
        Ids = new[]
        {
            "example_value",
        },
        Status = "example_value",
    });

    return new Dictionary<string, object?>
    {
        ["vpcNatIpId1"] = ids.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
        ["vpcNatIpId2"] = nameRegex.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
        ["vpcNatIpId3"] = natIpCidr.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
        ["vpcNatIpId4"] = natIpName.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
        ["vpcNatIpId5"] = natIpIds.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
        ["vpcNatIpId6"] = status.Apply(getNatIpsResult => getNatIpsResult.Ips[0]?.Id),
    };
});
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/vpc"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		ids, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			Ids: []string{
				"example_value-1",
				"example_value-2",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId1", ids.Ips[0].Id)
		nameRegex, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			NameRegex:    pulumi.StringRef("^my-NatIp"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId2", nameRegex.Ips[0].Id)
		natIpCidr, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			NatIpCidr:    pulumi.StringRef("example_value"),
			NameRegex:    pulumi.StringRef("^my-NatIp"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId3", natIpCidr.Ips[0].Id)
		natIpName, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			Ids: []string{
				"example_value",
			},
			NatIpNames: []string{
				"example_value",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId4", natIpName.Ips[0].Id)
		natIpIds, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			Ids: []string{
				"example_value",
			},
			NatIpIds: []string{
				"example_value",
			},
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId5", natIpIds.Ips[0].Id)
		status, err := vpc.GetNatIps(ctx, &vpc.GetNatIpsArgs{
			NatGatewayId: "example_value",
			Ids: []string{
				"example_value",
			},
			Status: pulumi.StringRef("example_value"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("vpcNatIpId6", status.Ips[0].Id)
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.vpc.VpcFunctions;
import com.pulumi.alicloud.vpc.inputs.GetNatIpsArgs;
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 ids = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .ids(            
                "example_value-1",
                "example_value-2")
            .build());

        ctx.export("vpcNatIpId1", ids.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
        final var nameRegex = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .nameRegex("^my-NatIp")
            .build());

        ctx.export("vpcNatIpId2", nameRegex.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
        final var natIpCidr = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .natIpCidr("example_value")
            .nameRegex("^my-NatIp")
            .build());

        ctx.export("vpcNatIpId3", natIpCidr.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
        final var natIpName = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .ids("example_value")
            .natIpNames("example_value")
            .build());

        ctx.export("vpcNatIpId4", natIpName.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
        final var natIpIds = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .ids("example_value")
            .natIpIds("example_value")
            .build());

        ctx.export("vpcNatIpId5", natIpIds.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
        final var status = VpcFunctions.getNatIps(GetNatIpsArgs.builder()
            .natGatewayId("example_value")
            .ids("example_value")
            .status("example_value")
            .build());

        ctx.export("vpcNatIpId6", status.applyValue(getNatIpsResult -> getNatIpsResult.ips()[0].id()));
    }
}
import pulumi
import pulumi_alicloud as alicloud

ids = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    ids=[
        "example_value-1",
        "example_value-2",
    ])
pulumi.export("vpcNatIpId1", ids.ips[0].id)
name_regex = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    name_regex="^my-NatIp")
pulumi.export("vpcNatIpId2", name_regex.ips[0].id)
nat_ip_cidr = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    nat_ip_cidr="example_value",
    name_regex="^my-NatIp")
pulumi.export("vpcNatIpId3", nat_ip_cidr.ips[0].id)
nat_ip_name = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    ids=["example_value"],
    nat_ip_names=["example_value"])
pulumi.export("vpcNatIpId4", nat_ip_name.ips[0].id)
nat_ip_ids = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    ids=["example_value"],
    nat_ip_ids=["example_value"])
pulumi.export("vpcNatIpId5", nat_ip_ids.ips[0].id)
status = alicloud.vpc.get_nat_ips(nat_gateway_id="example_value",
    ids=["example_value"],
    status="example_value")
pulumi.export("vpcNatIpId6", status.ips[0].id)
import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const ids = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    ids: [
        "example_value-1",
        "example_value-2",
    ],
});
export const vpcNatIpId1 = ids.then(ids => ids.ips?.[0]?.id);
const nameRegex = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    nameRegex: "^my-NatIp",
});
export const vpcNatIpId2 = nameRegex.then(nameRegex => nameRegex.ips?.[0]?.id);
const natIpCidr = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    natIpCidr: "example_value",
    nameRegex: "^my-NatIp",
});
export const vpcNatIpId3 = natIpCidr.then(natIpCidr => natIpCidr.ips?.[0]?.id);
const natIpName = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    ids: ["example_value"],
    natIpNames: ["example_value"],
});
export const vpcNatIpId4 = natIpName.then(natIpName => natIpName.ips?.[0]?.id);
const natIpIds = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    ids: ["example_value"],
    natIpIds: ["example_value"],
});
export const vpcNatIpId5 = natIpIds.then(natIpIds => natIpIds.ips?.[0]?.id);
const status = alicloud.vpc.getNatIps({
    natGatewayId: "example_value",
    ids: ["example_value"],
    status: "example_value",
});
export const vpcNatIpId6 = status.then(status => status.ips?.[0]?.id);
variables:
  ids:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        ids:
          - example_value-1
          - example_value-2
  nameRegex:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        nameRegex: ^my-NatIp
  natIpCidr:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        natIpCidr: example_value
        nameRegex: ^my-NatIp
  natIpName:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        ids:
          - example_value
        natIpNames:
          - example_value
  natIpIds:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        ids:
          - example_value
        natIpIds:
          - example_value
  status:
    fn::invoke:
      Function: alicloud:vpc:getNatIps
      Arguments:
        natGatewayId: example_value
        ids:
          - example_value
        status: example_value
outputs:
  vpcNatIpId1: ${ids.ips[0].id}
  vpcNatIpId2: ${nameRegex.ips[0].id}
  vpcNatIpId3: ${natIpCidr.ips[0].id}
  vpcNatIpId4: ${natIpName.ips[0].id}
  vpcNatIpId5: ${natIpIds.ips[0].id}
  vpcNatIpId6: ${status.ips[0].id}

Using getNatIps

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getNatIps(args: GetNatIpsArgs, opts?: InvokeOptions): Promise<GetNatIpsResult>
function getNatIpsOutput(args: GetNatIpsOutputArgs, opts?: InvokeOptions): Output<GetNatIpsResult>
def get_nat_ips(ids: Optional[Sequence[str]] = None,
                name_regex: Optional[str] = None,
                nat_gateway_id: Optional[str] = None,
                nat_ip_cidr: Optional[str] = None,
                nat_ip_ids: Optional[Sequence[str]] = None,
                nat_ip_names: Optional[Sequence[str]] = None,
                output_file: Optional[str] = None,
                status: Optional[str] = None,
                opts: Optional[InvokeOptions] = None) -> GetNatIpsResult
def get_nat_ips_output(ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                name_regex: Optional[pulumi.Input[str]] = None,
                nat_gateway_id: Optional[pulumi.Input[str]] = None,
                nat_ip_cidr: Optional[pulumi.Input[str]] = None,
                nat_ip_ids: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                nat_ip_names: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                output_file: Optional[pulumi.Input[str]] = None,
                status: Optional[pulumi.Input[str]] = None,
                opts: Optional[InvokeOptions] = None) -> Output[GetNatIpsResult]
func GetNatIps(ctx *Context, args *GetNatIpsArgs, opts ...InvokeOption) (*GetNatIpsResult, error)
func GetNatIpsOutput(ctx *Context, args *GetNatIpsOutputArgs, opts ...InvokeOption) GetNatIpsResultOutput

> Note: This function is named GetNatIps in the Go SDK.

public static class GetNatIps 
{
    public static Task<GetNatIpsResult> InvokeAsync(GetNatIpsArgs args, InvokeOptions? opts = null)
    public static Output<GetNatIpsResult> Invoke(GetNatIpsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetNatIpsResult> getNatIps(GetNatIpsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: alicloud:vpc/getNatIps:getNatIps
  arguments:
    # arguments dictionary

The following arguments are supported:

NatGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

Ids List<string>

A list of Nat Ip IDs.

NameRegex string

A regex string to filter results by Nat Ip name.

NatIpCidr string

The CIDR block to which the NAT IP address belongs.

NatIpIds List<string>
NatIpNames List<string>

The name of the NAT IP address.

OutputFile string
Status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

NatGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

Ids []string

A list of Nat Ip IDs.

NameRegex string

A regex string to filter results by Nat Ip name.

NatIpCidr string

The CIDR block to which the NAT IP address belongs.

NatIpIds []string
NatIpNames []string

The name of the NAT IP address.

OutputFile string
Status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

natGatewayId String

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

ids List<String>

A list of Nat Ip IDs.

nameRegex String

A regex string to filter results by Nat Ip name.

natIpCidr String

The CIDR block to which the NAT IP address belongs.

natIpIds List<String>
natIpNames List<String>

The name of the NAT IP address.

outputFile String
status String

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

natGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

ids string[]

A list of Nat Ip IDs.

nameRegex string

A regex string to filter results by Nat Ip name.

natIpCidr string

The CIDR block to which the NAT IP address belongs.

natIpIds string[]
natIpNames string[]

The name of the NAT IP address.

outputFile string
status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

nat_gateway_id str

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

ids Sequence[str]

A list of Nat Ip IDs.

name_regex str

A regex string to filter results by Nat Ip name.

nat_ip_cidr str

The CIDR block to which the NAT IP address belongs.

nat_ip_ids Sequence[str]
nat_ip_names Sequence[str]

The name of the NAT IP address.

output_file str
status str

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

natGatewayId String

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

ids List<String>

A list of Nat Ip IDs.

nameRegex String

A regex string to filter results by Nat Ip name.

natIpCidr String

The CIDR block to which the NAT IP address belongs.

natIpIds List<String>
natIpNames List<String>

The name of the NAT IP address.

outputFile String
status String

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

getNatIps Result

The following output properties are available:

Id string

The provider-assigned unique ID for this managed resource.

Ids List<string>
Ips List<Pulumi.AliCloud.Vpc.Outputs.GetNatIpsIp>
Names List<string>
NatGatewayId string
NameRegex string
NatIpCidr string
NatIpIds List<string>
NatIpNames List<string>
OutputFile string
Status string
Id string

The provider-assigned unique ID for this managed resource.

Ids []string
Ips []GetNatIpsIp
Names []string
NatGatewayId string
NameRegex string
NatIpCidr string
NatIpIds []string
NatIpNames []string
OutputFile string
Status string
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
ips List<GetNatIpsIp>
names List<String>
natGatewayId String
nameRegex String
natIpCidr String
natIpIds List<String>
natIpNames List<String>
outputFile String
status String
id string

The provider-assigned unique ID for this managed resource.

ids string[]
ips GetNatIpsIp[]
names string[]
natGatewayId string
nameRegex string
natIpCidr string
natIpIds string[]
natIpNames string[]
outputFile string
status string
id str

The provider-assigned unique ID for this managed resource.

ids Sequence[str]
ips Sequence[GetNatIpsIp]
names Sequence[str]
nat_gateway_id str
name_regex str
nat_ip_cidr str
nat_ip_ids Sequence[str]
nat_ip_names Sequence[str]
output_file str
status str
id String

The provider-assigned unique ID for this managed resource.

ids List<String>
ips List<Property Map>
names List<String>
natGatewayId String
nameRegex String
natIpCidr String
natIpIds List<String>
natIpNames List<String>
outputFile String
status String

Supporting Types

GetNatIpsIp

Id string

The ID of the Nat Ip.

IsDefault bool

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

NatGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

NatIp string

The NAT IP address that is queried.

NatIpCidr string

The CIDR block to which the NAT IP address belongs.

NatIpDescription string

The description of the NAT IP address.

NatIpId string

The ID of the NAT IP address.

NatIpName string

The name of the NAT IP address.

Status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

Id string

The ID of the Nat Ip.

IsDefault bool

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

NatGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

NatIp string

The NAT IP address that is queried.

NatIpCidr string

The CIDR block to which the NAT IP address belongs.

NatIpDescription string

The description of the NAT IP address.

NatIpId string

The ID of the NAT IP address.

NatIpName string

The name of the NAT IP address.

Status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

id String

The ID of the Nat Ip.

isDefault Boolean

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

natGatewayId String

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

natIp String

The NAT IP address that is queried.

natIpCidr String

The CIDR block to which the NAT IP address belongs.

natIpDescription String

The description of the NAT IP address.

natIpId String

The ID of the NAT IP address.

natIpName String

The name of the NAT IP address.

status String

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

id string

The ID of the Nat Ip.

isDefault boolean

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

natGatewayId string

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

natIp string

The NAT IP address that is queried.

natIpCidr string

The CIDR block to which the NAT IP address belongs.

natIpDescription string

The description of the NAT IP address.

natIpId string

The ID of the NAT IP address.

natIpName string

The name of the NAT IP address.

status string

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

id str

The ID of the Nat Ip.

is_default bool

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

nat_gateway_id str

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

nat_ip str

The NAT IP address that is queried.

nat_ip_cidr str

The CIDR block to which the NAT IP address belongs.

nat_ip_description str

The description of the NAT IP address.

nat_ip_id str

The ID of the NAT IP address.

nat_ip_name str

The name of the NAT IP address.

status str

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

id String

The ID of the Nat Ip.

isDefault Boolean

Indicates whether the BGP Group is the default NAT IP ADDRESS. Valid values: true: is the default NAT IP ADDRESS. false: it is not the default NAT IP ADDRESS.

natGatewayId String

The ID of the Virtual Private Cloud (VPC) NAT gateway to which the NAT IP address belongs.

natIp String

The NAT IP address that is queried.

natIpCidr String

The CIDR block to which the NAT IP address belongs.

natIpDescription String

The description of the NAT IP address.

natIpId String

The ID of the NAT IP address.

natIpName String

The name of the NAT IP address.

status String

The status of the NAT IP address. Valid values: Available, Deleting and Creating.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes

This Pulumi package is based on the alicloud Terraform Provider.