ionoscloud.compute.NatGateway
Explore with Pulumi AI
Manages a Nat Gateway on IonosCloud.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@ionos-cloud/sdk-pulumi";
const example = new ionoscloud.compute.Datacenter("example", {
name: "Datacenter Example",
location: "us/las",
description: "Datacenter Description",
secAuthProtection: false,
});
const exampleIPBlock = new ionoscloud.compute.IPBlock("example", {
location: "us/las",
size: 2,
name: "IP Block Example",
});
const exampleLan = new ionoscloud.compute.Lan("example", {
datacenterId: example.id,
"public": true,
name: "Lan Example",
});
const exampleNatGateway = new ionoscloud.compute.NatGateway("example", {
datacenterId: example.id,
name: "example",
publicIps: [
exampleIPBlock.ips[0],
exampleIPBlock.ips[1],
],
lans: [{
id: exampleLan.id,
gatewayIps: ["10.11.2.5"],
}],
});
import pulumi
import pulumi_ionoscloud as ionoscloud
example = ionoscloud.compute.Datacenter("example",
name="Datacenter Example",
location="us/las",
description="Datacenter Description",
sec_auth_protection=False)
example_ip_block = ionoscloud.compute.IPBlock("example",
location="us/las",
size=2,
name="IP Block Example")
example_lan = ionoscloud.compute.Lan("example",
datacenter_id=example.id,
public=True,
name="Lan Example")
example_nat_gateway = ionoscloud.compute.NatGateway("example",
datacenter_id=example.id,
name="example",
public_ips=[
example_ip_block.ips[0],
example_ip_block.ips[1],
],
lans=[{
"id": example_lan.id,
"gateway_ips": ["10.11.2.5"],
}])
package main
import (
"github.com/ionos-cloud/pulumi-ionoscloud/sdk/go/ionoscloud/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := compute.NewDatacenter(ctx, "example", &compute.DatacenterArgs{
Name: pulumi.String("Datacenter Example"),
Location: pulumi.String("us/las"),
Description: pulumi.String("Datacenter Description"),
SecAuthProtection: pulumi.Bool(false),
})
if err != nil {
return err
}
exampleIPBlock, err := compute.NewIPBlock(ctx, "example", &compute.IPBlockArgs{
Location: pulumi.String("us/las"),
Size: pulumi.Int(2),
Name: pulumi.String("IP Block Example"),
})
if err != nil {
return err
}
exampleLan, err := compute.NewLan(ctx, "example", &compute.LanArgs{
DatacenterId: example.ID(),
Public: pulumi.Bool(true),
Name: pulumi.String("Lan Example"),
})
if err != nil {
return err
}
_, err = compute.NewNatGateway(ctx, "example", &compute.NatGatewayArgs{
DatacenterId: example.ID(),
Name: pulumi.String("example"),
PublicIps: pulumi.StringArray{
exampleIPBlock.Ips.ApplyT(func(ips []string) (string, error) {
return ips[0], nil
}).(pulumi.StringOutput),
exampleIPBlock.Ips.ApplyT(func(ips []string) (string, error) {
return ips[1], nil
}).(pulumi.StringOutput),
},
Lans: compute.NatGatewayLanArray{
&compute.NatGatewayLanArgs{
Id: exampleLan.ID(),
GatewayIps: pulumi.StringArray{
pulumi.String("10.11.2.5"),
},
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Ionoscloud.Pulumi.Ionoscloud;
return await Deployment.RunAsync(() =>
{
var example = new Ionoscloud.Compute.Datacenter("example", new()
{
Name = "Datacenter Example",
Location = "us/las",
Description = "Datacenter Description",
SecAuthProtection = false,
});
var exampleIPBlock = new Ionoscloud.Compute.IPBlock("example", new()
{
Location = "us/las",
Size = 2,
Name = "IP Block Example",
});
var exampleLan = new Ionoscloud.Compute.Lan("example", new()
{
DatacenterId = example.Id,
Public = true,
Name = "Lan Example",
});
var exampleNatGateway = new Ionoscloud.Compute.NatGateway("example", new()
{
DatacenterId = example.Id,
Name = "example",
PublicIps = new[]
{
exampleIPBlock.Ips.Apply(ips => ips[0]),
exampleIPBlock.Ips.Apply(ips => ips[1]),
},
Lans = new[]
{
new Ionoscloud.Compute.Inputs.NatGatewayLanArgs
{
Id = exampleLan.Id,
GatewayIps = new[]
{
"10.11.2.5",
},
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.compute.Datacenter;
import com.pulumi.ionoscloud.compute.DatacenterArgs;
import com.pulumi.ionoscloud.compute.IPBlock;
import com.pulumi.ionoscloud.compute.IPBlockArgs;
import com.pulumi.ionoscloud.compute.Lan;
import com.pulumi.ionoscloud.compute.LanArgs;
import com.pulumi.ionoscloud.compute.NatGateway;
import com.pulumi.ionoscloud.compute.NatGatewayArgs;
import com.pulumi.ionoscloud.compute.inputs.NatGatewayLanArgs;
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) {
var example = new Datacenter("example", DatacenterArgs.builder()
.name("Datacenter Example")
.location("us/las")
.description("Datacenter Description")
.secAuthProtection(false)
.build());
var exampleIPBlock = new IPBlock("exampleIPBlock", IPBlockArgs.builder()
.location("us/las")
.size(2)
.name("IP Block Example")
.build());
var exampleLan = new Lan("exampleLan", LanArgs.builder()
.datacenterId(example.id())
.public_(true)
.name("Lan Example")
.build());
var exampleNatGateway = new NatGateway("exampleNatGateway", NatGatewayArgs.builder()
.datacenterId(example.id())
.name("example")
.publicIps(
exampleIPBlock.ips().applyValue(ips -> ips[0]),
exampleIPBlock.ips().applyValue(ips -> ips[1]))
.lans(NatGatewayLanArgs.builder()
.id(exampleLan.id())
.gatewayIps("10.11.2.5")
.build())
.build());
}
}
resources:
example:
type: ionoscloud:compute:Datacenter
properties:
name: Datacenter Example
location: us/las
description: Datacenter Description
secAuthProtection: false
exampleIPBlock:
type: ionoscloud:compute:IPBlock
name: example
properties:
location: us/las
size: 2
name: IP Block Example
exampleLan:
type: ionoscloud:compute:Lan
name: example
properties:
datacenterId: ${example.id}
public: true
name: Lan Example
exampleNatGateway:
type: ionoscloud:compute:NatGateway
name: example
properties:
datacenterId: ${example.id}
name: example
publicIps:
- ${exampleIPBlock.ips[0]}
- ${exampleIPBlock.ips[1]}
lans:
- id: ${exampleLan.id}
gatewayIps:
- 10.11.2.5
Create NatGateway Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NatGateway(name: string, args: NatGatewayArgs, opts?: CustomResourceOptions);
@overload
def NatGateway(resource_name: str,
args: NatGatewayArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NatGateway(resource_name: str,
opts: Optional[ResourceOptions] = None,
datacenter_id: Optional[str] = None,
lans: Optional[Sequence[NatGatewayLanArgs]] = None,
public_ips: Optional[Sequence[str]] = None,
name: Optional[str] = None)
func NewNatGateway(ctx *Context, name string, args NatGatewayArgs, opts ...ResourceOption) (*NatGateway, error)
public NatGateway(string name, NatGatewayArgs args, CustomResourceOptions? opts = null)
public NatGateway(String name, NatGatewayArgs args)
public NatGateway(String name, NatGatewayArgs args, CustomResourceOptions options)
type: ionoscloud:compute:NatGateway
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 NatGatewayArgs
- 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 NatGatewayArgs
- 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 NatGatewayArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NatGatewayArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NatGatewayArgs
- 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 natGatewayResource = new Ionoscloud.Compute.NatGateway("natGatewayResource", new()
{
DatacenterId = "string",
Lans = new[]
{
new Ionoscloud.Compute.Inputs.NatGatewayLanArgs
{
Id = 0,
GatewayIps = new[]
{
"string",
},
},
},
PublicIps = new[]
{
"string",
},
Name = "string",
});
example, err := compute.NewNatGateway(ctx, "natGatewayResource", &compute.NatGatewayArgs{
DatacenterId: pulumi.String("string"),
Lans: compute.NatGatewayLanArray{
&compute.NatGatewayLanArgs{
Id: pulumi.Int(0),
GatewayIps: pulumi.StringArray{
pulumi.String("string"),
},
},
},
PublicIps: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
})
var natGatewayResource = new NatGateway("natGatewayResource", NatGatewayArgs.builder()
.datacenterId("string")
.lans(NatGatewayLanArgs.builder()
.id(0)
.gatewayIps("string")
.build())
.publicIps("string")
.name("string")
.build());
nat_gateway_resource = ionoscloud.compute.NatGateway("natGatewayResource",
datacenter_id="string",
lans=[{
"id": 0,
"gateway_ips": ["string"],
}],
public_ips=["string"],
name="string")
const natGatewayResource = new ionoscloud.compute.NatGateway("natGatewayResource", {
datacenterId: "string",
lans: [{
id: 0,
gatewayIps: ["string"],
}],
publicIps: ["string"],
name: "string",
});
type: ionoscloud:compute:NatGateway
properties:
datacenterId: string
lans:
- gatewayIps:
- string
id: 0
name: string
publicIps:
- string
NatGateway 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 NatGateway resource accepts the following input properties:
- Datacenter
Id string - [string] A Datacenter's UUID.
- Lans
List<Ionoscloud.
Nat Gateway Lan> - [list] A list of Local Area Networks the node pool should be part of.
- Public
Ips List<string> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- Name string
- [string] Name of the NAT gateway.
- Datacenter
Id string - [string] A Datacenter's UUID.
- Lans
[]Nat
Gateway Lan Args - [list] A list of Local Area Networks the node pool should be part of.
- Public
Ips []string - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- Name string
- [string] Name of the NAT gateway.
- datacenter
Id String - [string] A Datacenter's UUID.
- lans
List<Nat
Gateway Lan> - [list] A list of Local Area Networks the node pool should be part of.
- public
Ips List<String> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- name String
- [string] Name of the NAT gateway.
- datacenter
Id string - [string] A Datacenter's UUID.
- lans
Nat
Gateway Lan[] - [list] A list of Local Area Networks the node pool should be part of.
- public
Ips string[] - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- name string
- [string] Name of the NAT gateway.
- datacenter_
id str - [string] A Datacenter's UUID.
- lans
Sequence[Nat
Gateway Lan Args] - [list] A list of Local Area Networks the node pool should be part of.
- public_
ips Sequence[str] - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- name str
- [string] Name of the NAT gateway.
- datacenter
Id String - [string] A Datacenter's UUID.
- lans List<Property Map>
- [list] A list of Local Area Networks the node pool should be part of.
- public
Ips List<String> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- name String
- [string] Name of the NAT gateway.
Outputs
All input properties are implicitly available as output properties. Additionally, the NatGateway resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing NatGateway Resource
Get an existing NatGateway 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?: NatGatewayState, opts?: CustomResourceOptions): NatGateway
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
datacenter_id: Optional[str] = None,
lans: Optional[Sequence[NatGatewayLanArgs]] = None,
name: Optional[str] = None,
public_ips: Optional[Sequence[str]] = None) -> NatGateway
func GetNatGateway(ctx *Context, name string, id IDInput, state *NatGatewayState, opts ...ResourceOption) (*NatGateway, error)
public static NatGateway Get(string name, Input<string> id, NatGatewayState? state, CustomResourceOptions? opts = null)
public static NatGateway get(String name, Output<String> id, NatGatewayState state, CustomResourceOptions options)
resources: _: type: ionoscloud:compute:NatGateway 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.
- Datacenter
Id string - [string] A Datacenter's UUID.
- Lans
List<Ionoscloud.
Nat Gateway Lan> - [list] A list of Local Area Networks the node pool should be part of.
- Name string
- [string] Name of the NAT gateway.
- Public
Ips List<string> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- Datacenter
Id string - [string] A Datacenter's UUID.
- Lans
[]Nat
Gateway Lan Args - [list] A list of Local Area Networks the node pool should be part of.
- Name string
- [string] Name of the NAT gateway.
- Public
Ips []string - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- datacenter
Id String - [string] A Datacenter's UUID.
- lans
List<Nat
Gateway Lan> - [list] A list of Local Area Networks the node pool should be part of.
- name String
- [string] Name of the NAT gateway.
- public
Ips List<String> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- datacenter
Id string - [string] A Datacenter's UUID.
- lans
Nat
Gateway Lan[] - [list] A list of Local Area Networks the node pool should be part of.
- name string
- [string] Name of the NAT gateway.
- public
Ips string[] - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- datacenter_
id str - [string] A Datacenter's UUID.
- lans
Sequence[Nat
Gateway Lan Args] - [list] A list of Local Area Networks the node pool should be part of.
- name str
- [string] Name of the NAT gateway.
- public_
ips Sequence[str] - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
- datacenter
Id String - [string] A Datacenter's UUID.
- lans List<Property Map>
- [list] A list of Local Area Networks the node pool should be part of.
- name String
- [string] Name of the NAT gateway.
- public
Ips List<String> - [list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
Supporting Types
NatGatewayLan, NatGatewayLanArgs
- Id int
- [int] Id for the LAN connected to the NAT gateway.
- Gateway
Ips List<string> - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
- Id int
- [int] Id for the LAN connected to the NAT gateway.
- Gateway
Ips []string - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
- id Integer
- [int] Id for the LAN connected to the NAT gateway.
- gateway
Ips List<String> - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
- id number
- [int] Id for the LAN connected to the NAT gateway.
- gateway
Ips string[] - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
- id int
- [int] Id for the LAN connected to the NAT gateway.
- gateway_
ips Sequence[str] - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
- id Number
- [int] Id for the LAN connected to the NAT gateway.
- gateway
Ips List<String> - [list] Collection of gateway IP addresses of the NAT gateway. Will be auto-generated if not provided. Should ideally be an IP belonging to the same subnet as the LAN.
Import
A Nat Gateway resource can be imported using its resource id
and the datacenter id
, e.g.
$ pulumi import ionoscloud:compute/natGateway:NatGateway my_natgateway datacenter uuid/nat gateway uuid
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ionoscloud ionos-cloud/pulumi-ionoscloud
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
ionoscloud
Terraform Provider.