1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. Natgateway
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.Natgateway

Explore with Pulumi AI

Manages a Nat Gateway on IonosCloud.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";

const exampleDatacenter = new ionoscloud.Datacenter("exampleDatacenter", {
    location: "us/las",
    description: "Datacenter Description",
    secAuthProtection: false,
});
const exampleIpblock = new ionoscloud.Ipblock("exampleIpblock", {
    location: "us/las",
    size: 2,
});
const exampleLan = new ionoscloud.Lan("exampleLan", {
    datacenterId: exampleDatacenter.datacenterId,
    "public": true,
});
const exampleNatgateway = new ionoscloud.Natgateway("exampleNatgateway", {
    datacenterId: exampleDatacenter.datacenterId,
    publicIps: [
        exampleIpblock.ips[0],
        exampleIpblock.ips[1],
    ],
    lans: [{
        id: exampleLan.lanId,
        gatewayIps: ["10.11.2.5"],
    }],
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example_datacenter = ionoscloud.Datacenter("exampleDatacenter",
    location="us/las",
    description="Datacenter Description",
    sec_auth_protection=False)
example_ipblock = ionoscloud.Ipblock("exampleIpblock",
    location="us/las",
    size=2)
example_lan = ionoscloud.Lan("exampleLan",
    datacenter_id=example_datacenter.datacenter_id,
    public=True)
example_natgateway = ionoscloud.Natgateway("exampleNatgateway",
    datacenter_id=example_datacenter.datacenter_id,
    public_ips=[
        example_ipblock.ips[0],
        example_ipblock.ips[1],
    ],
    lans=[{
        "id": example_lan.lan_id,
        "gateway_ips": ["10.11.2.5"],
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleDatacenter, err := ionoscloud.NewDatacenter(ctx, "exampleDatacenter", &ionoscloud.DatacenterArgs{
			Location:          pulumi.String("us/las"),
			Description:       pulumi.String("Datacenter Description"),
			SecAuthProtection: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		exampleIpblock, err := ionoscloud.NewIpblock(ctx, "exampleIpblock", &ionoscloud.IpblockArgs{
			Location: pulumi.String("us/las"),
			Size:     pulumi.Float64(2),
		})
		if err != nil {
			return err
		}
		exampleLan, err := ionoscloud.NewLan(ctx, "exampleLan", &ionoscloud.LanArgs{
			DatacenterId: exampleDatacenter.DatacenterId,
			Public:       pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_, err = ionoscloud.NewNatgateway(ctx, "exampleNatgateway", &ionoscloud.NatgatewayArgs{
			DatacenterId: exampleDatacenter.DatacenterId,
			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: ionoscloud.NatgatewayLanArray{
				&ionoscloud.NatgatewayLanArgs{
					Id: exampleLan.LanId,
					GatewayIps: pulumi.StringArray{
						pulumi.String("10.11.2.5"),
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ionoscloud = Pulumi.Ionoscloud;

return await Deployment.RunAsync(() => 
{
    var exampleDatacenter = new Ionoscloud.Datacenter("exampleDatacenter", new()
    {
        Location = "us/las",
        Description = "Datacenter Description",
        SecAuthProtection = false,
    });

    var exampleIpblock = new Ionoscloud.Ipblock("exampleIpblock", new()
    {
        Location = "us/las",
        Size = 2,
    });

    var exampleLan = new Ionoscloud.Lan("exampleLan", new()
    {
        DatacenterId = exampleDatacenter.DatacenterId,
        Public = true,
    });

    var exampleNatgateway = new Ionoscloud.Natgateway("exampleNatgateway", new()
    {
        DatacenterId = exampleDatacenter.DatacenterId,
        PublicIps = new[]
        {
            exampleIpblock.Ips.Apply(ips => ips[0]),
            exampleIpblock.Ips.Apply(ips => ips[1]),
        },
        Lans = new[]
        {
            new Ionoscloud.Inputs.NatgatewayLanArgs
            {
                Id = exampleLan.LanId,
                GatewayIps = new[]
                {
                    "10.11.2.5",
                },
            },
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ionoscloud.Datacenter;
import com.pulumi.ionoscloud.DatacenterArgs;
import com.pulumi.ionoscloud.Ipblock;
import com.pulumi.ionoscloud.IpblockArgs;
import com.pulumi.ionoscloud.Lan;
import com.pulumi.ionoscloud.LanArgs;
import com.pulumi.ionoscloud.Natgateway;
import com.pulumi.ionoscloud.NatgatewayArgs;
import com.pulumi.ionoscloud.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 exampleDatacenter = new Datacenter("exampleDatacenter", DatacenterArgs.builder()
            .location("us/las")
            .description("Datacenter Description")
            .secAuthProtection(false)
            .build());

        var exampleIpblock = new Ipblock("exampleIpblock", IpblockArgs.builder()
            .location("us/las")
            .size(2)
            .build());

        var exampleLan = new Lan("exampleLan", LanArgs.builder()
            .datacenterId(exampleDatacenter.datacenterId())
            .public_(true)
            .build());

        var exampleNatgateway = new Natgateway("exampleNatgateway", NatgatewayArgs.builder()
            .datacenterId(exampleDatacenter.datacenterId())
            .publicIps(            
                exampleIpblock.ips().applyValue(ips -> ips[0]),
                exampleIpblock.ips().applyValue(ips -> ips[1]))
            .lans(NatgatewayLanArgs.builder()
                .id(exampleLan.lanId())
                .gatewayIps("10.11.2.5")
                .build())
            .build());

    }
}
Copy
resources:
  exampleDatacenter:
    type: ionoscloud:Datacenter
    properties:
      location: us/las
      description: Datacenter Description
      secAuthProtection: false
  exampleIpblock:
    type: ionoscloud:Ipblock
    properties:
      location: us/las
      size: 2
  exampleLan:
    type: ionoscloud:Lan
    properties:
      datacenterId: ${exampleDatacenter.datacenterId}
      public: true
  exampleNatgateway:
    type: ionoscloud:Natgateway
    properties:
      datacenterId: ${exampleDatacenter.datacenterId}
      publicIps:
        - ${exampleIpblock.ips[0]}
        - ${exampleIpblock.ips[1]}
      lans:
        - id: ${exampleLan.lanId}
          gatewayIps:
            - 10.11.2.5
Copy

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,
               natgateway_id: Optional[str] = None,
               timeouts: Optional[NatgatewayTimeoutsArgs] = 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:Natgateway
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. NatgatewayArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. 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 This property is required. string
The unique name of the resource.
args This property is required. NatgatewayArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. NatgatewayArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. 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.Natgateway("natgatewayResource", new()
{
    DatacenterId = "string",
    Lans = new[]
    {
        new Ionoscloud.Inputs.NatgatewayLanArgs
        {
            Id = 0,
            GatewayIps = new[]
            {
                "string",
            },
        },
    },
    PublicIps = new[]
    {
        "string",
    },
    Name = "string",
    NatgatewayId = "string",
    Timeouts = new Ionoscloud.Inputs.NatgatewayTimeoutsArgs
    {
        Create = "string",
        Default = "string",
        Delete = "string",
        Update = "string",
    },
});
Copy
example, err := ionoscloud.NewNatgateway(ctx, "natgatewayResource", &ionoscloud.NatgatewayArgs{
DatacenterId: pulumi.String("string"),
Lans: .NatgatewayLanArray{
&.NatgatewayLanArgs{
Id: pulumi.Float64(0),
GatewayIps: pulumi.StringArray{
pulumi.String("string"),
},
},
},
PublicIps: pulumi.StringArray{
pulumi.String("string"),
},
Name: pulumi.String("string"),
NatgatewayId: pulumi.String("string"),
Timeouts: &.NatgatewayTimeoutsArgs{
Create: pulumi.String("string"),
Default: pulumi.String("string"),
Delete: pulumi.String("string"),
Update: pulumi.String("string"),
},
})
Copy
var natgatewayResource = new Natgateway("natgatewayResource", NatgatewayArgs.builder()
    .datacenterId("string")
    .lans(NatgatewayLanArgs.builder()
        .id(0)
        .gatewayIps("string")
        .build())
    .publicIps("string")
    .name("string")
    .natgatewayId("string")
    .timeouts(NatgatewayTimeoutsArgs.builder()
        .create("string")
        .default_("string")
        .delete("string")
        .update("string")
        .build())
    .build());
Copy
natgateway_resource = ionoscloud.Natgateway("natgatewayResource",
    datacenter_id="string",
    lans=[{
        "id": 0,
        "gateway_ips": ["string"],
    }],
    public_ips=["string"],
    name="string",
    natgateway_id="string",
    timeouts={
        "create": "string",
        "default": "string",
        "delete": "string",
        "update": "string",
    })
Copy
const natgatewayResource = new ionoscloud.Natgateway("natgatewayResource", {
    datacenterId: "string",
    lans: [{
        id: 0,
        gatewayIps: ["string"],
    }],
    publicIps: ["string"],
    name: "string",
    natgatewayId: "string",
    timeouts: {
        create: "string",
        "default": "string",
        "delete": "string",
        update: "string",
    },
});
Copy
type: ionoscloud:Natgateway
properties:
    datacenterId: string
    lans:
        - gatewayIps:
            - string
          id: 0
    name: string
    natgatewayId: string
    publicIps:
        - string
    timeouts:
        create: string
        default: string
        delete: string
        update: string
Copy

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:

DatacenterId This property is required. string
[string] A Datacenter's UUID.
Lans This property is required. List<NatgatewayLan>
[list] A list of Local Area Networks the node pool should be part of.
PublicIps This property is required. 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.
NatgatewayId string
Timeouts NatgatewayTimeouts
DatacenterId This property is required. string
[string] A Datacenter's UUID.
Lans This property is required. []NatgatewayLanArgs
[list] A list of Local Area Networks the node pool should be part of.
PublicIps This property is required. []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.
NatgatewayId string
Timeouts NatgatewayTimeoutsArgs
datacenterId This property is required. String
[string] A Datacenter's UUID.
lans This property is required. List<NatgatewayLan>
[list] A list of Local Area Networks the node pool should be part of.
publicIps This property is required. 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.
natgatewayId String
timeouts NatgatewayTimeouts
datacenterId This property is required. string
[string] A Datacenter's UUID.
lans This property is required. NatgatewayLan[]
[list] A list of Local Area Networks the node pool should be part of.
publicIps This property is required. 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.
natgatewayId string
timeouts NatgatewayTimeouts
datacenter_id This property is required. str
[string] A Datacenter's UUID.
lans This property is required. Sequence[NatgatewayLanArgs]
[list] A list of Local Area Networks the node pool should be part of.
public_ips This property is required. 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.
natgateway_id str
timeouts NatgatewayTimeoutsArgs
datacenterId This property is required. String
[string] A Datacenter's UUID.
lans This property is required. List<Property Map>
[list] A list of Local Area Networks the node pool should be part of.
publicIps This property is required. 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.
natgatewayId String
timeouts Property Map

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,
        natgateway_id: Optional[str] = None,
        public_ips: Optional[Sequence[str]] = None,
        timeouts: Optional[NatgatewayTimeoutsArgs] = 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:Natgateway    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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.
The following state arguments are supported:
DatacenterId string
[string] A Datacenter's UUID.
Lans List<NatgatewayLan>
[list] A list of Local Area Networks the node pool should be part of.
Name string
[string] Name of the NAT gateway.
NatgatewayId string
PublicIps List<string>
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
Timeouts NatgatewayTimeouts
DatacenterId string
[string] A Datacenter's UUID.
Lans []NatgatewayLanArgs
[list] A list of Local Area Networks the node pool should be part of.
Name string
[string] Name of the NAT gateway.
NatgatewayId string
PublicIps []string
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
Timeouts NatgatewayTimeoutsArgs
datacenterId String
[string] A Datacenter's UUID.
lans List<NatgatewayLan>
[list] A list of Local Area Networks the node pool should be part of.
name String
[string] Name of the NAT gateway.
natgatewayId String
publicIps List<String>
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
timeouts NatgatewayTimeouts
datacenterId string
[string] A Datacenter's UUID.
lans NatgatewayLan[]
[list] A list of Local Area Networks the node pool should be part of.
name string
[string] Name of the NAT gateway.
natgatewayId string
publicIps string[]
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
timeouts NatgatewayTimeouts
datacenter_id str
[string] A Datacenter's UUID.
lans Sequence[NatgatewayLanArgs]
[list] A list of Local Area Networks the node pool should be part of.
name str
[string] Name of the NAT gateway.
natgateway_id str
public_ips Sequence[str]
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
timeouts NatgatewayTimeoutsArgs
datacenterId 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.
natgatewayId String
publicIps List<String>
[list]Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location.
timeouts Property Map

Supporting Types

NatgatewayLan
, NatgatewayLanArgs

Id This property is required. double
[int] Id for the LAN connected to the NAT gateway.
GatewayIps 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 This property is required. float64
[int] Id for the LAN connected to the NAT gateway.
GatewayIps []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 This property is required. Double
[int] Id for the LAN connected to the NAT gateway.
gatewayIps 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 This property is required. number
[int] Id for the LAN connected to the NAT gateway.
gatewayIps 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 This property is required. float
[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 This property is required. Number
[int] Id for the LAN connected to the NAT gateway.
gatewayIps 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.

NatgatewayTimeouts
, NatgatewayTimeoutsArgs

Create string
Default string
Delete string
Update string
Create string
Default string
Delete string
Update string
create String
default_ String
delete String
update String
create string
default string
delete string
update string
create String
default String
delete String
update String

Import

A Nat Gateway resource can be imported using its resource id and the datacenter id, e.g.

$ pulumi import ionoscloud:index/natgateway:Natgateway my_natgateway datacenter uuid/nat gateway uuid
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
ionoscloud ionos-cloud/terraform-provider-ionoscloud
License
Notes
This Pulumi package is based on the ionoscloud Terraform Provider.