Provides a resource to manage nat ip
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.getZones({});
const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
vpcName: "acc-test-vpc",
cidrBlock: "172.16.0.0/16",
});
const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
subnetName: "acc-test-subnet",
cidrBlock: "172.16.0.0/24",
zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
vpcId: fooVpc.id,
});
const intranetNatGateway = new volcengine.nat.Gateway("intranetNatGateway", {
vpcId: fooVpc.id,
subnetId: fooSubnet.id,
natGatewayName: "acc-test-intranet_ng",
description: "acc-test",
networkType: "intranet",
billingType: "PostPaidByUsage",
projectName: "default",
tags: [{
key: "k1",
value: "v1",
}],
});
const fooIp = new volcengine.nat.Ip("fooIp", {
natGatewayId: intranetNatGateway.id,
natIpName: "acc-test-nat-ip",
natIpDescription: "acc-test",
natIp: "172.16.0.3",
});
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.get_zones()
foo_vpc = volcengine.vpc.Vpc("fooVpc",
vpc_name="acc-test-vpc",
cidr_block="172.16.0.0/16")
foo_subnet = volcengine.vpc.Subnet("fooSubnet",
subnet_name="acc-test-subnet",
cidr_block="172.16.0.0/24",
zone_id=foo_zones.zones[0].id,
vpc_id=foo_vpc.id)
intranet_nat_gateway = volcengine.nat.Gateway("intranetNatGateway",
vpc_id=foo_vpc.id,
subnet_id=foo_subnet.id,
nat_gateway_name="acc-test-intranet_ng",
description="acc-test",
network_type="intranet",
billing_type="PostPaidByUsage",
project_name="default",
tags=[volcengine.nat.GatewayTagArgs(
key="k1",
value="v1",
)])
foo_ip = volcengine.nat.Ip("fooIp",
nat_gateway_id=intranet_nat_gateway.id,
nat_ip_name="acc-test-nat-ip",
nat_ip_description="acc-test",
nat_ip="172.16.0.3")
package main
import (
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/nat"
"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
fooZones, err := ecs.GetZones(ctx, nil, nil)
if err != nil {
return err
}
fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
VpcName: pulumi.String("acc-test-vpc"),
CidrBlock: pulumi.String("172.16.0.0/16"),
})
if err != nil {
return err
}
fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
SubnetName: pulumi.String("acc-test-subnet"),
CidrBlock: pulumi.String("172.16.0.0/24"),
ZoneId: pulumi.String(fooZones.Zones[0].Id),
VpcId: fooVpc.ID(),
})
if err != nil {
return err
}
intranetNatGateway, err := nat.NewGateway(ctx, "intranetNatGateway", &nat.GatewayArgs{
VpcId: fooVpc.ID(),
SubnetId: fooSubnet.ID(),
NatGatewayName: pulumi.String("acc-test-intranet_ng"),
Description: pulumi.String("acc-test"),
NetworkType: pulumi.String("intranet"),
BillingType: pulumi.String("PostPaidByUsage"),
ProjectName: pulumi.String("default"),
Tags: nat.GatewayTagArray{
&nat.GatewayTagArgs{
Key: pulumi.String("k1"),
Value: pulumi.String("v1"),
},
},
})
if err != nil {
return err
}
_, err = nat.NewIp(ctx, "fooIp", &nat.IpArgs{
NatGatewayId: intranetNatGateway.ID(),
NatIpName: pulumi.String("acc-test-nat-ip"),
NatIpDescription: pulumi.String("acc-test"),
NatIp: pulumi.String("172.16.0.3"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooZones = Volcengine.Ecs.GetZones.Invoke();
var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
{
VpcName = "acc-test-vpc",
CidrBlock = "172.16.0.0/16",
});
var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
{
SubnetName = "acc-test-subnet",
CidrBlock = "172.16.0.0/24",
ZoneId = fooZones.Apply(getZonesResult => getZonesResult.Zones[0]?.Id),
VpcId = fooVpc.Id,
});
var intranetNatGateway = new Volcengine.Nat.Gateway("intranetNatGateway", new()
{
VpcId = fooVpc.Id,
SubnetId = fooSubnet.Id,
NatGatewayName = "acc-test-intranet_ng",
Description = "acc-test",
NetworkType = "intranet",
BillingType = "PostPaidByUsage",
ProjectName = "default",
Tags = new[]
{
new Volcengine.Nat.Inputs.GatewayTagArgs
{
Key = "k1",
Value = "v1",
},
},
});
var fooIp = new Volcengine.Nat.Ip("fooIp", new()
{
NatGatewayId = intranetNatGateway.Id,
NatIpName = "acc-test-nat-ip",
NatIpDescription = "acc-test",
NatIp = "172.16.0.3",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.volcengine.ecs.EcsFunctions;
import com.pulumi.volcengine.ecs.inputs.GetZonesArgs;
import com.pulumi.volcengine.vpc.Vpc;
import com.pulumi.volcengine.vpc.VpcArgs;
import com.pulumi.volcengine.vpc.Subnet;
import com.pulumi.volcengine.vpc.SubnetArgs;
import com.pulumi.volcengine.nat.Gateway;
import com.pulumi.volcengine.nat.GatewayArgs;
import com.pulumi.volcengine.nat.inputs.GatewayTagArgs;
import com.pulumi.volcengine.nat.Ip;
import com.pulumi.volcengine.nat.IpArgs;
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 fooZones = EcsFunctions.getZones();
var fooVpc = new Vpc("fooVpc", VpcArgs.builder()
.vpcName("acc-test-vpc")
.cidrBlock("172.16.0.0/16")
.build());
var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()
.subnetName("acc-test-subnet")
.cidrBlock("172.16.0.0/24")
.zoneId(fooZones.applyValue(getZonesResult -> getZonesResult.zones()[0].id()))
.vpcId(fooVpc.id())
.build());
var intranetNatGateway = new Gateway("intranetNatGateway", GatewayArgs.builder()
.vpcId(fooVpc.id())
.subnetId(fooSubnet.id())
.natGatewayName("acc-test-intranet_ng")
.description("acc-test")
.networkType("intranet")
.billingType("PostPaidByUsage")
.projectName("default")
.tags(GatewayTagArgs.builder()
.key("k1")
.value("v1")
.build())
.build());
var fooIp = new Ip("fooIp", IpArgs.builder()
.natGatewayId(intranetNatGateway.id())
.natIpName("acc-test-nat-ip")
.natIpDescription("acc-test")
.natIp("172.16.0.3")
.build());
}
}
resources:
fooVpc:
type: volcengine:vpc:Vpc
properties:
vpcName: acc-test-vpc
cidrBlock: 172.16.0.0/16
fooSubnet:
type: volcengine:vpc:Subnet
properties:
subnetName: acc-test-subnet
cidrBlock: 172.16.0.0/24
zoneId: ${fooZones.zones[0].id}
vpcId: ${fooVpc.id}
intranetNatGateway:
type: volcengine:nat:Gateway
properties:
vpcId: ${fooVpc.id}
subnetId: ${fooSubnet.id}
natGatewayName: acc-test-intranet_ng
description: acc-test
networkType: intranet
billingType: PostPaidByUsage
projectName: default
tags:
- key: k1
value: v1
fooIp:
type: volcengine:nat:Ip
properties:
natGatewayId: ${intranetNatGateway.id}
natIpName: acc-test-nat-ip
natIpDescription: acc-test
natIp: 172.16.0.3
variables:
fooZones:
fn::invoke:
Function: volcengine:ecs:getZones
Arguments: {}
Create Ip Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Ip(name: string, args: IpArgs, opts?: CustomResourceOptions);@overload
def Ip(resource_name: str,
args: IpArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Ip(resource_name: str,
opts: Optional[ResourceOptions] = None,
nat_gateway_id: Optional[str] = None,
nat_ip: Optional[str] = None,
nat_ip_description: Optional[str] = None,
nat_ip_name: Optional[str] = None)func NewIp(ctx *Context, name string, args IpArgs, opts ...ResourceOption) (*Ip, error)public Ip(string name, IpArgs args, CustomResourceOptions? opts = null)type: volcengine:nat:Ip
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args IpArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args IpArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args IpArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args IpArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args IpArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var ipResource = new Volcengine.Nat.Ip("ipResource", new()
{
NatGatewayId = "string",
NatIp = "string",
NatIpDescription = "string",
NatIpName = "string",
});
example, err := nat.NewIp(ctx, "ipResource", &nat.IpArgs{
NatGatewayId: pulumi.String("string"),
NatIp: pulumi.String("string"),
NatIpDescription: pulumi.String("string"),
NatIpName: pulumi.String("string"),
})
var ipResource = new Ip("ipResource", IpArgs.builder()
.natGatewayId("string")
.natIp("string")
.natIpDescription("string")
.natIpName("string")
.build());
ip_resource = volcengine.nat.Ip("ipResource",
nat_gateway_id="string",
nat_ip="string",
nat_ip_description="string",
nat_ip_name="string")
const ipResource = new volcengine.nat.Ip("ipResource", {
natGatewayId: "string",
natIp: "string",
natIpDescription: "string",
natIpName: "string",
});
type: volcengine:nat:Ip
properties:
natGatewayId: string
natIp: string
natIpDescription: string
natIpName: string
Ip 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 Ip resource accepts the following input properties:
- Nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- Nat
Ip string - The ip address of the Nat Ip.
- Nat
Ip stringDescription - The description of the Nat Ip.
- Nat
Ip stringName - The name of the Nat Ip.
- Nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- Nat
Ip string - The ip address of the Nat Ip.
- Nat
Ip stringDescription - The description of the Nat Ip.
- Nat
Ip stringName - The name of the Nat Ip.
- nat
Gateway StringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip String - The ip address of the Nat Ip.
- nat
Ip StringDescription - The description of the Nat Ip.
- nat
Ip StringName - The name of the Nat Ip.
- nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip string - The ip address of the Nat Ip.
- nat
Ip stringDescription - The description of the Nat Ip.
- nat
Ip stringName - The name of the Nat Ip.
- nat_
gateway_ strid - The id of the nat gateway to which the Nat Ip belongs.
- nat_
ip str - The ip address of the Nat Ip.
- nat_
ip_ strdescription - The description of the Nat Ip.
- nat_
ip_ strname - The name of the Nat Ip.
- nat
Gateway StringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip String - The ip address of the Nat Ip.
- nat
Ip StringDescription - The description of the Nat Ip.
- nat
Ip StringName - The name of the Nat Ip.
Outputs
All input properties are implicitly available as output properties. Additionally, the Ip resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Default bool - Whether the Ip is the default Nat Ip.
- Status string
- The status of the Nat Ip.
- Using
Status string - The using status of the Nat Ip.
- Id string
- The provider-assigned unique ID for this managed resource.
- Is
Default bool - Whether the Ip is the default Nat Ip.
- Status string
- The status of the Nat Ip.
- Using
Status string - The using status of the Nat Ip.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Default Boolean - Whether the Ip is the default Nat Ip.
- status String
- The status of the Nat Ip.
- using
Status String - The using status of the Nat Ip.
- id string
- The provider-assigned unique ID for this managed resource.
- is
Default boolean - Whether the Ip is the default Nat Ip.
- status string
- The status of the Nat Ip.
- using
Status string - The using status of the Nat Ip.
- id str
- The provider-assigned unique ID for this managed resource.
- is_
default bool - Whether the Ip is the default Nat Ip.
- status str
- The status of the Nat Ip.
- using_
status str - The using status of the Nat Ip.
- id String
- The provider-assigned unique ID for this managed resource.
- is
Default Boolean - Whether the Ip is the default Nat Ip.
- status String
- The status of the Nat Ip.
- using
Status String - The using status of the Nat Ip.
Look up Existing Ip Resource
Get an existing Ip 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?: IpState, opts?: CustomResourceOptions): Ip@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
is_default: Optional[bool] = None,
nat_gateway_id: Optional[str] = None,
nat_ip: Optional[str] = None,
nat_ip_description: Optional[str] = None,
nat_ip_name: Optional[str] = None,
status: Optional[str] = None,
using_status: Optional[str] = None) -> Ipfunc GetIp(ctx *Context, name string, id IDInput, state *IpState, opts ...ResourceOption) (*Ip, error)public static Ip Get(string name, Input<string> id, IpState? state, CustomResourceOptions? opts = null)public static Ip get(String name, Output<String> id, IpState state, CustomResourceOptions options)resources: _: type: volcengine:nat:Ip get: id: ${id}- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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
- The unique name of the resulting resource.
- id
- 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.
- Is
Default bool - Whether the Ip is the default Nat Ip.
- Nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- Nat
Ip string - The ip address of the Nat Ip.
- Nat
Ip stringDescription - The description of the Nat Ip.
- Nat
Ip stringName - The name of the Nat Ip.
- Status string
- The status of the Nat Ip.
- Using
Status string - The using status of the Nat Ip.
- Is
Default bool - Whether the Ip is the default Nat Ip.
- Nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- Nat
Ip string - The ip address of the Nat Ip.
- Nat
Ip stringDescription - The description of the Nat Ip.
- Nat
Ip stringName - The name of the Nat Ip.
- Status string
- The status of the Nat Ip.
- Using
Status string - The using status of the Nat Ip.
- is
Default Boolean - Whether the Ip is the default Nat Ip.
- nat
Gateway StringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip String - The ip address of the Nat Ip.
- nat
Ip StringDescription - The description of the Nat Ip.
- nat
Ip StringName - The name of the Nat Ip.
- status String
- The status of the Nat Ip.
- using
Status String - The using status of the Nat Ip.
- is
Default boolean - Whether the Ip is the default Nat Ip.
- nat
Gateway stringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip string - The ip address of the Nat Ip.
- nat
Ip stringDescription - The description of the Nat Ip.
- nat
Ip stringName - The name of the Nat Ip.
- status string
- The status of the Nat Ip.
- using
Status string - The using status of the Nat Ip.
- is_
default bool - Whether the Ip is the default Nat Ip.
- nat_
gateway_ strid - The id of the nat gateway to which the Nat Ip belongs.
- nat_
ip str - The ip address of the Nat Ip.
- nat_
ip_ strdescription - The description of the Nat Ip.
- nat_
ip_ strname - The name of the Nat Ip.
- status str
- The status of the Nat Ip.
- using_
status str - The using status of the Nat Ip.
- is
Default Boolean - Whether the Ip is the default Nat Ip.
- nat
Gateway StringId - The id of the nat gateway to which the Nat Ip belongs.
- nat
Ip String - The ip address of the Nat Ip.
- nat
Ip StringDescription - The description of the Nat Ip.
- nat
Ip StringName - The name of the Nat Ip.
- status String
- The status of the Nat Ip.
- using
Status String - The using status of the Nat Ip.
Import
NatIp can be imported using the id, e.g.
$ pulumi import volcengine:nat/ip:Ip default resource_id
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- volcengine volcengine/pulumi-volcengine
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
volcengineTerraform Provider.
