getNatIpCidrs

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

NOTE: Available in v1.136.0+.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";
const ids = alicloud.vpc.getNatIpCidrs({
natGatewayId: "example_value",
ids: [
"example_value-1",
"example_value-2",
],
});
export const vpcNatIpCidrId1 = ids.then(ids => ids.cidrs?.[0]?.id);
const nameRegex = alicloud.vpc.getNatIpCidrs({
natGatewayId: "example_value",
nameRegex: "^my-NatIpCidr",
});
export const vpcNatIpCidrId2 = nameRegex.then(nameRegex => nameRegex.cidrs?.[0]?.id);
const status = alicloud.vpc.getNatIpCidrs({
natGatewayId: "example_value",
ids: ["example_value-1"],
status: "Available",
});
export const vpcNatIpCidrId3 = status.then(status => status.cidrs?.[0]?.id);
const natIpCidr = alicloud.vpc.getNatIpCidrs({
natGatewayId: "example_value",
natIpCidrs: ["example_value-1"],
});
export const vpcNatIpCidrId4 = natIpCidr.then(natIpCidr => natIpCidr.cidrs?.[0]?.id);
const atIpCidrName = alicloud.vpc.getNatIpCidrs({
natGatewayId: "example_value",
natIpCidrNames: ["example_value-1"],
});
export const vpcNatIpCidrId5 = atIpCidrName.then(atIpCidrName => atIpCidrName.cidrs?.[0]?.id);
import pulumi
import pulumi_alicloud as alicloud
ids = alicloud.vpc.get_nat_ip_cidrs(nat_gateway_id="example_value",
ids=[
"example_value-1",
"example_value-2",
])
pulumi.export("vpcNatIpCidrId1", ids.cidrs[0].id)
name_regex = alicloud.vpc.get_nat_ip_cidrs(nat_gateway_id="example_value",
name_regex="^my-NatIpCidr")
pulumi.export("vpcNatIpCidrId2", name_regex.cidrs[0].id)
status = alicloud.vpc.get_nat_ip_cidrs(nat_gateway_id="example_value",
ids=["example_value-1"],
status="Available")
pulumi.export("vpcNatIpCidrId3", status.cidrs[0].id)
nat_ip_cidr = alicloud.vpc.get_nat_ip_cidrs(nat_gateway_id="example_value",
nat_ip_cidrs=["example_value-1"])
pulumi.export("vpcNatIpCidrId4", nat_ip_cidr.cidrs[0].id)
at_ip_cidr_name = alicloud.vpc.get_nat_ip_cidrs(nat_gateway_id="example_value",
nat_ip_cidr_names=["example_value-1"])
pulumi.export("vpcNatIpCidrId5", at_ip_cidr_name.cidrs[0].id)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;
return await Deployment.RunAsync(() =>
{
var ids = AliCloud.Vpc.GetNatIpCidrs.Invoke(new()
{
NatGatewayId = "example_value",
Ids = new[]
{
"example_value-1",
"example_value-2",
},
});
var nameRegex = AliCloud.Vpc.GetNatIpCidrs.Invoke(new()
{
NatGatewayId = "example_value",
NameRegex = "^my-NatIpCidr",
});
var status = AliCloud.Vpc.GetNatIpCidrs.Invoke(new()
{
NatGatewayId = "example_value",
Ids = new[]
{
"example_value-1",
},
Status = "Available",
});
var natIpCidr = AliCloud.Vpc.GetNatIpCidrs.Invoke(new()
{
NatGatewayId = "example_value",
NatIpCidrs = new[]
{
"example_value-1",
},
});
var atIpCidrName = AliCloud.Vpc.GetNatIpCidrs.Invoke(new()
{
NatGatewayId = "example_value",
NatIpCidrNames = new[]
{
"example_value-1",
},
});
return new Dictionary<string, object?>
{
["vpcNatIpCidrId1"] = ids&#46;Apply(getNatIpCidrsResult => getNatIpCidrsResult&#46;Cidrs[0]?.Id),
["vpcNatIpCidrId2"] = nameRegex&#46;Apply(getNatIpCidrsResult => getNatIpCidrsResult&#46;Cidrs[0]?.Id),
["vpcNatIpCidrId3"] = status&#46;Apply(getNatIpCidrsResult => getNatIpCidrsResult&#46;Cidrs[0]?.Id),
["vpcNatIpCidrId4"] = natIpCidr&#46;Apply(getNatIpCidrsResult => getNatIpCidrsResult&#46;Cidrs[0]?.Id),
["vpcNatIpCidrId5"] = atIpCidrName&#46;Apply(getNatIpCidrsResult => getNatIpCidrsResult&#46;Cidrs[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.GetNatIpCidrs(ctx, &vpc.GetNatIpCidrsArgs{
NatGatewayId: "example_value",
Ids: []string{
"example_value-1",
"example_value-2",
},
}, nil)
if err != nil {
return err
}
ctx.Export("vpcNatIpCidrId1", ids.Cidrs[0].Id)
nameRegex, err := vpc.GetNatIpCidrs(ctx, &vpc.GetNatIpCidrsArgs{
NatGatewayId: "example_value",
NameRegex: pulumi.StringRef("^my-NatIpCidr"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcNatIpCidrId2", nameRegex.Cidrs[0].Id)
status, err := vpc.GetNatIpCidrs(ctx, &vpc.GetNatIpCidrsArgs{
NatGatewayId: "example_value",
Ids: []string{
"example_value-1",
},
Status: pulumi.StringRef("Available"),
}, nil)
if err != nil {
return err
}
ctx.Export("vpcNatIpCidrId3", status.Cidrs[0].Id)
natIpCidr, err := vpc.GetNatIpCidrs(ctx, &vpc.GetNatIpCidrsArgs{
NatGatewayId: "example_value",
NatIpCidrs: []string{
"example_value-1",
},
}, nil)
if err != nil {
return err
}
ctx.Export("vpcNatIpCidrId4", natIpCidr.Cidrs[0].Id)
atIpCidrName, err := vpc.GetNatIpCidrs(ctx, &vpc.GetNatIpCidrsArgs{
NatGatewayId: "example_value",
NatIpCidrNames: []string{
"example_value-1",
},
}, nil)
if err != nil {
return err
}
ctx.Export("vpcNatIpCidrId5", atIpCidrName.Cidrs[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.GetNatIpCidrsArgs;
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.getNatIpCidrs(GetNatIpCidrsArgs.builder()
.natGatewayId("example_value")
.ids(
"example_value-1",
"example_value-2")
.build());
ctx.export("vpcNatIpCidrId1", ids.applyValue(getNatIpCidrsResult -> getNatIpCidrsResult.cidrs()[0].id()));
final var nameRegex = VpcFunctions.getNatIpCidrs(GetNatIpCidrsArgs.builder()
.natGatewayId("example_value")
.nameRegex("^my-NatIpCidr")
.build());
ctx.export("vpcNatIpCidrId2", nameRegex.applyValue(getNatIpCidrsResult -> getNatIpCidrsResult.cidrs()[0].id()));
final var status = VpcFunctions.getNatIpCidrs(GetNatIpCidrsArgs.builder()
.natGatewayId("example_value")
.ids("example_value-1")
.status("Available")
.build());
ctx.export("vpcNatIpCidrId3", status.applyValue(getNatIpCidrsResult -> getNatIpCidrsResult.cidrs()[0].id()));
final var natIpCidr = VpcFunctions.getNatIpCidrs(GetNatIpCidrsArgs.builder()
.natGatewayId("example_value")
.natIpCidrs("example_value-1")
.build());
ctx.export("vpcNatIpCidrId4", natIpCidr.applyValue(getNatIpCidrsResult -> getNatIpCidrsResult.cidrs()[0].id()));
final var atIpCidrName = VpcFunctions.getNatIpCidrs(GetNatIpCidrsArgs.builder()
.natGatewayId("example_value")
.natIpCidrNames("example_value-1")
.build());
ctx.export("vpcNatIpCidrId5", atIpCidrName.applyValue(getNatIpCidrsResult -> getNatIpCidrsResult.cidrs()[0].id()));
}
}
variables:
ids:
fn::invoke:
function: alicloud:vpc:getNatIpCidrs
arguments:
natGatewayId: example_value
ids:
- example_value-1
- example_value-2
nameRegex:
fn::invoke:
function: alicloud:vpc:getNatIpCidrs
arguments:
natGatewayId: example_value
nameRegex: ^my-NatIpCidr
status:
fn::invoke:
function: alicloud:vpc:getNatIpCidrs
arguments:
natGatewayId: example_value
ids:
- example_value-1
status: Available
natIpCidr:
fn::invoke:
function: alicloud:vpc:getNatIpCidrs
arguments:
natGatewayId: example_value
natIpCidrs:
- example_value-1
atIpCidrName:
fn::invoke:
function: alicloud:vpc:getNatIpCidrs
arguments:
natGatewayId: example_value
natIpCidrNames:
- example_value-1
outputs:
vpcNatIpCidrId1: ${ids.cidrs[0].id}
vpcNatIpCidrId2: ${nameRegex.cidrs[0].id}
vpcNatIpCidrId3: ${status.cidrs[0].id}
vpcNatIpCidrId4: ${natIpCidr.cidrs[0].id}
vpcNatIpCidrId5: ${atIpCidrName.cidrs[0].id}

Return

A collection of values returned by getNatIpCidrs.

Parameters

argument

A collection of arguments for invoking getNatIpCidrs.


suspend fun getNatIpCidrs(ids: List<String>? = null, nameRegex: String? = null, natGatewayId: String, natIpCidrNames: List<String>? = null, natIpCidrs: List<String>? = null, outputFile: String? = null, status: String? = null): GetNatIpCidrsResult

Return

A collection of values returned by getNatIpCidrs.

Parameters

ids

A list of Nat Ip Cidr IDs.

nameRegex

A regex string to filter results by Nat Ip Cidr name.

natGatewayId

NAT IP ADDRESS range to the security group of the Kafka VPC NAT gateway instance ID.

natIpCidrNames

The name of the CIDR block that you want to query. Support up to 20.

natIpCidrs

The NAT CIDR block to be created. Support up to 20. The CIDR block must meet the following conditions: It must be 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, or one of their subnets. The subnet mask must be 16 to 32 bits in lengths. To use a public CIDR block as the NAT CIDR block, the VPC to which the VPC NAT gateway belongs must be authorized to use public CIDR blocks. For more information, see Create a VPC NAT gateway.

outputFile

File name where to save data source results (after running pulumi preview).

status

The status of the NAT IP address. Valid values:Available.

See also


Return

A collection of values returned by getNatIpCidrs.

Parameters

argument

Builder for com.pulumi.alicloud.vpc.kotlin.inputs.GetNatIpCidrsPlainArgs.

See also