volcengine.nat.SnatEntry
Explore with Pulumi AI
Provides a resource to manage snat entry
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Volcengine = Pulumi.Volcengine;
return await Deployment.RunAsync(() =>
{
var fooZones = Volcengine.Ecs.Zones.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(zonesResult => zonesResult.Zones[0]?.Id),
VpcId = fooVpc.Id,
});
var fooGateway = new Volcengine.Nat.Gateway("fooGateway", new()
{
VpcId = fooVpc.Id,
SubnetId = fooSubnet.Id,
Spec = "Small",
NatGatewayName = "acc-test-ng",
Description = "acc-test",
BillingType = "PostPaid",
ProjectName = "default",
Tags = new[]
{
new Volcengine.Nat.Inputs.GatewayTagArgs
{
Key = "k1",
Value = "v1",
},
},
});
var fooAddress = new Volcengine.Eip.Address("fooAddress", new()
{
Description = "acc-test",
Bandwidth = 1,
BillingType = "PostPaidByBandwidth",
Isp = "BGP",
});
var fooAssociate = new Volcengine.Eip.Associate("fooAssociate", new()
{
AllocationId = fooAddress.Id,
InstanceId = fooGateway.Id,
InstanceType = "Nat",
});
var fooSnatEntry = new Volcengine.Nat.SnatEntry("fooSnatEntry", new()
{
SnatEntryName = "acc-test-snat-entry",
NatGatewayId = fooGateway.Id,
EipId = fooAddress.Id,
SourceCidr = "172.16.0.0/24",
}, new CustomResourceOptions
{
DependsOn = new[]
{
fooAssociate,
},
});
});
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/eip"
"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.Zones(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
}
fooGateway, err := nat.NewGateway(ctx, "fooGateway", &nat.GatewayArgs{
VpcId: fooVpc.ID(),
SubnetId: fooSubnet.ID(),
Spec: pulumi.String("Small"),
NatGatewayName: pulumi.String("acc-test-ng"),
Description: pulumi.String("acc-test"),
BillingType: pulumi.String("PostPaid"),
ProjectName: pulumi.String("default"),
Tags: nat.GatewayTagArray{
&nat.GatewayTagArgs{
Key: pulumi.String("k1"),
Value: pulumi.String("v1"),
},
},
})
if err != nil {
return err
}
fooAddress, err := eip.NewAddress(ctx, "fooAddress", &eip.AddressArgs{
Description: pulumi.String("acc-test"),
Bandwidth: pulumi.Int(1),
BillingType: pulumi.String("PostPaidByBandwidth"),
Isp: pulumi.String("BGP"),
})
if err != nil {
return err
}
fooAssociate, err := eip.NewAssociate(ctx, "fooAssociate", &eip.AssociateArgs{
AllocationId: fooAddress.ID(),
InstanceId: fooGateway.ID(),
InstanceType: pulumi.String("Nat"),
})
if err != nil {
return err
}
_, err = nat.NewSnatEntry(ctx, "fooSnatEntry", &nat.SnatEntryArgs{
SnatEntryName: pulumi.String("acc-test-snat-entry"),
NatGatewayId: fooGateway.ID(),
EipId: fooAddress.ID(),
SourceCidr: pulumi.String("172.16.0.0/24"),
}, pulumi.DependsOn([]pulumi.Resource{
fooAssociate,
}))
if err != nil {
return err
}
return nil
})
}
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.ZonesArgs;
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.eip.Address;
import com.pulumi.volcengine.eip.AddressArgs;
import com.pulumi.volcengine.eip.Associate;
import com.pulumi.volcengine.eip.AssociateArgs;
import com.pulumi.volcengine.nat.SnatEntry;
import com.pulumi.volcengine.nat.SnatEntryArgs;
import com.pulumi.resources.CustomResourceOptions;
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.Zones();
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(zonesResult -> zonesResult.zones()[0].id()))
.vpcId(fooVpc.id())
.build());
var fooGateway = new Gateway("fooGateway", GatewayArgs.builder()
.vpcId(fooVpc.id())
.subnetId(fooSubnet.id())
.spec("Small")
.natGatewayName("acc-test-ng")
.description("acc-test")
.billingType("PostPaid")
.projectName("default")
.tags(GatewayTagArgs.builder()
.key("k1")
.value("v1")
.build())
.build());
var fooAddress = new Address("fooAddress", AddressArgs.builder()
.description("acc-test")
.bandwidth(1)
.billingType("PostPaidByBandwidth")
.isp("BGP")
.build());
var fooAssociate = new Associate("fooAssociate", AssociateArgs.builder()
.allocationId(fooAddress.id())
.instanceId(fooGateway.id())
.instanceType("Nat")
.build());
var fooSnatEntry = new SnatEntry("fooSnatEntry", SnatEntryArgs.builder()
.snatEntryName("acc-test-snat-entry")
.natGatewayId(fooGateway.id())
.eipId(fooAddress.id())
.sourceCidr("172.16.0.0/24")
.build(), CustomResourceOptions.builder()
.dependsOn(fooAssociate)
.build());
}
}
import pulumi
import pulumi_volcengine as volcengine
foo_zones = volcengine.ecs.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)
foo_gateway = volcengine.nat.Gateway("fooGateway",
vpc_id=foo_vpc.id,
subnet_id=foo_subnet.id,
spec="Small",
nat_gateway_name="acc-test-ng",
description="acc-test",
billing_type="PostPaid",
project_name="default",
tags=[volcengine.nat.GatewayTagArgs(
key="k1",
value="v1",
)])
foo_address = volcengine.eip.Address("fooAddress",
description="acc-test",
bandwidth=1,
billing_type="PostPaidByBandwidth",
isp="BGP")
foo_associate = volcengine.eip.Associate("fooAssociate",
allocation_id=foo_address.id,
instance_id=foo_gateway.id,
instance_type="Nat")
foo_snat_entry = volcengine.nat.SnatEntry("fooSnatEntry",
snat_entry_name="acc-test-snat-entry",
nat_gateway_id=foo_gateway.id,
eip_id=foo_address.id,
source_cidr="172.16.0.0/24",
opts=pulumi.ResourceOptions(depends_on=[foo_associate]))
import * as pulumi from "@pulumi/pulumi";
import * as volcengine from "@pulumi/volcengine";
import * as volcengine from "@volcengine/pulumi";
const fooZones = volcengine.ecs.Zones({});
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 fooGateway = new volcengine.nat.Gateway("fooGateway", {
vpcId: fooVpc.id,
subnetId: fooSubnet.id,
spec: "Small",
natGatewayName: "acc-test-ng",
description: "acc-test",
billingType: "PostPaid",
projectName: "default",
tags: [{
key: "k1",
value: "v1",
}],
});
const fooAddress = new volcengine.eip.Address("fooAddress", {
description: "acc-test",
bandwidth: 1,
billingType: "PostPaidByBandwidth",
isp: "BGP",
});
const fooAssociate = new volcengine.eip.Associate("fooAssociate", {
allocationId: fooAddress.id,
instanceId: fooGateway.id,
instanceType: "Nat",
});
const fooSnatEntry = new volcengine.nat.SnatEntry("fooSnatEntry", {
snatEntryName: "acc-test-snat-entry",
natGatewayId: fooGateway.id,
eipId: fooAddress.id,
sourceCidr: "172.16.0.0/24",
}, {
dependsOn: [fooAssociate],
});
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}
fooGateway:
type: volcengine:nat:Gateway
properties:
vpcId: ${fooVpc.id}
subnetId: ${fooSubnet.id}
spec: Small
natGatewayName: acc-test-ng
description: acc-test
billingType: PostPaid
projectName: default
tags:
- key: k1
value: v1
fooAddress:
type: volcengine:eip:Address
properties:
description: acc-test
bandwidth: 1
billingType: PostPaidByBandwidth
isp: BGP
fooAssociate:
type: volcengine:eip:Associate
properties:
allocationId: ${fooAddress.id}
instanceId: ${fooGateway.id}
instanceType: Nat
fooSnatEntry:
type: volcengine:nat:SnatEntry
properties:
snatEntryName: acc-test-snat-entry
natGatewayId: ${fooGateway.id}
eipId: ${fooAddress.id}
sourceCidr: 172.16.0.0/24
options:
dependson:
- ${fooAssociate}
variables:
fooZones:
fn::invoke:
Function: volcengine:ecs:Zones
Arguments: {}
Create SnatEntry Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SnatEntry(name: string, args: SnatEntryArgs, opts?: CustomResourceOptions);
@overload
def SnatEntry(resource_name: str,
args: SnatEntryArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SnatEntry(resource_name: str,
opts: Optional[ResourceOptions] = None,
eip_id: Optional[str] = None,
nat_gateway_id: Optional[str] = None,
snat_entry_name: Optional[str] = None,
source_cidr: Optional[str] = None,
subnet_id: Optional[str] = None)
func NewSnatEntry(ctx *Context, name string, args SnatEntryArgs, opts ...ResourceOption) (*SnatEntry, error)
public SnatEntry(string name, SnatEntryArgs args, CustomResourceOptions? opts = null)
public SnatEntry(String name, SnatEntryArgs args)
public SnatEntry(String name, SnatEntryArgs args, CustomResourceOptions options)
type: volcengine:nat:SnatEntry
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 SnatEntryArgs
- 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 SnatEntryArgs
- 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 SnatEntryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SnatEntryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SnatEntryArgs
- 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 snatEntryResource = new Volcengine.Nat.SnatEntry("snatEntryResource", new()
{
EipId = "string",
NatGatewayId = "string",
SnatEntryName = "string",
SourceCidr = "string",
SubnetId = "string",
});
example, err := nat.NewSnatEntry(ctx, "snatEntryResource", &nat.SnatEntryArgs{
EipId: pulumi.String("string"),
NatGatewayId: pulumi.String("string"),
SnatEntryName: pulumi.String("string"),
SourceCidr: pulumi.String("string"),
SubnetId: pulumi.String("string"),
})
var snatEntryResource = new SnatEntry("snatEntryResource", SnatEntryArgs.builder()
.eipId("string")
.natGatewayId("string")
.snatEntryName("string")
.sourceCidr("string")
.subnetId("string")
.build());
snat_entry_resource = volcengine.nat.SnatEntry("snatEntryResource",
eip_id="string",
nat_gateway_id="string",
snat_entry_name="string",
source_cidr="string",
subnet_id="string")
const snatEntryResource = new volcengine.nat.SnatEntry("snatEntryResource", {
eipId: "string",
natGatewayId: "string",
snatEntryName: "string",
sourceCidr: "string",
subnetId: "string",
});
type: volcengine:nat:SnatEntry
properties:
eipId: string
natGatewayId: string
snatEntryName: string
sourceCidr: string
subnetId: string
SnatEntry Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The SnatEntry resource accepts the following input properties:
- Eip
Id string - The id of the public ip address used by the SNAT entry.
- Nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- Snat
Entry stringName - The name of the SNAT entry.
- Source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - Subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- Eip
Id string - The id of the public ip address used by the SNAT entry.
- Nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- Snat
Entry stringName - The name of the SNAT entry.
- Source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - Subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id String - The id of the public ip address used by the SNAT entry.
- nat
Gateway StringId - The id of the nat gateway to which the entry belongs.
- snat
Entry StringName - The name of the SNAT entry.
- source
Cidr String - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - subnet
Id String - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id string - The id of the public ip address used by the SNAT entry.
- nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- snat
Entry stringName - The name of the SNAT entry.
- source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip_
id str - The id of the public ip address used by the SNAT entry.
- nat_
gateway_ strid - The id of the nat gateway to which the entry belongs.
- snat_
entry_ strname - The name of the SNAT entry.
- source_
cidr str - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - subnet_
id str - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id String - The id of the public ip address used by the SNAT entry.
- nat
Gateway StringId - The id of the nat gateway to which the entry belongs.
- snat
Entry StringName - The name of the SNAT entry.
- source
Cidr String - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - subnet
Id String - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
Outputs
All input properties are implicitly available as output properties. Additionally, the SnatEntry resource produces the following output properties:
Look up Existing SnatEntry Resource
Get an existing SnatEntry 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?: SnatEntryState, opts?: CustomResourceOptions): SnatEntry
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
eip_id: Optional[str] = None,
nat_gateway_id: Optional[str] = None,
snat_entry_name: Optional[str] = None,
source_cidr: Optional[str] = None,
status: Optional[str] = None,
subnet_id: Optional[str] = None) -> SnatEntry
func GetSnatEntry(ctx *Context, name string, id IDInput, state *SnatEntryState, opts ...ResourceOption) (*SnatEntry, error)
public static SnatEntry Get(string name, Input<string> id, SnatEntryState? state, CustomResourceOptions? opts = null)
public static SnatEntry get(String name, Output<String> id, SnatEntryState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- 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.
- Eip
Id string - The id of the public ip address used by the SNAT entry.
- Nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- Snat
Entry stringName - The name of the SNAT entry.
- Source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - Status string
- The status of the SNAT entry.
- Subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- Eip
Id string - The id of the public ip address used by the SNAT entry.
- Nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- Snat
Entry stringName - The name of the SNAT entry.
- Source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - Status string
- The status of the SNAT entry.
- Subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id String - The id of the public ip address used by the SNAT entry.
- nat
Gateway StringId - The id of the nat gateway to which the entry belongs.
- snat
Entry StringName - The name of the SNAT entry.
- source
Cidr String - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - status String
- The status of the SNAT entry.
- subnet
Id String - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id string - The id of the public ip address used by the SNAT entry.
- nat
Gateway stringId - The id of the nat gateway to which the entry belongs.
- snat
Entry stringName - The name of the SNAT entry.
- source
Cidr string - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - status string
- The status of the SNAT entry.
- subnet
Id string - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip_
id str - The id of the public ip address used by the SNAT entry.
- nat_
gateway_ strid - The id of the nat gateway to which the entry belongs.
- snat_
entry_ strname - The name of the SNAT entry.
- source_
cidr str - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - status str
- The status of the SNAT entry.
- subnet_
id str - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
- eip
Id String - The id of the public ip address used by the SNAT entry.
- nat
Gateway StringId - The id of the nat gateway to which the entry belongs.
- snat
Entry StringName - The name of the SNAT entry.
- source
Cidr String - The SourceCidr of the SNAT entry. Only one of
subnet_id,source_cidr
can be specified. - status String
- The status of the SNAT entry.
- subnet
Id String - The id of the subnet that is required to access the internet. Only one of
subnet_id,source_cidr
can be specified.
Import
Snat entry can be imported using the id, e.g.
$ pulumi import volcengine:nat/snatEntry:SnatEntry default snat-3fvhk47kf56****
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
volcengine
Terraform Provider.