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

ionoscloud.getNatgateway

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    The NAT gateway data source can be used to search for and return existing NAT Gateways. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search string so that it is specific enough to return only one result.

    Example Usage

    By ID

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getNatgateway({
        datacenterId: "datacenter_id",
        id: "nat_gateway_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_natgateway(datacenter_id="datacenter_id",
        id="nat_gateway_id")
    
    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 {
    		_, err := ionoscloud.LookupNatgateway(ctx, &ionoscloud.LookupNatgatewayArgs{
    			DatacenterId: "datacenter_id",
    			Id:           pulumi.StringRef("nat_gateway_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetNatgateway.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Id = "nat_gateway_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetNatgatewayArgs;
    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 example = IonoscloudFunctions.getNatgateway(GetNatgatewayArgs.builder()
                .datacenterId("datacenter_id")
                .id("nat_gateway_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getNatgateway
          arguments:
            datacenterId: datacenter_id
            id: nat_gateway_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getNatgateway({
        datacenterId: "datacenter_id",
        name: "NAT Gateway Example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_natgateway(datacenter_id="datacenter_id",
        name="NAT Gateway Example")
    
    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 {
    		_, err := ionoscloud.LookupNatgateway(ctx, &ionoscloud.LookupNatgatewayArgs{
    			DatacenterId: "datacenter_id",
    			Name:         pulumi.StringRef("NAT Gateway Example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetNatgateway.Invoke(new()
        {
            DatacenterId = "datacenter_id",
            Name = "NAT Gateway Example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetNatgatewayArgs;
    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 example = IonoscloudFunctions.getNatgateway(GetNatgatewayArgs.builder()
                .datacenterId("datacenter_id")
                .name("NAT Gateway Example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getNatgateway
          arguments:
            datacenterId: datacenter_id
            name: NAT Gateway Example
    

    Using getNatgateway

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getNatgateway(args: GetNatgatewayArgs, opts?: InvokeOptions): Promise<GetNatgatewayResult>
    function getNatgatewayOutput(args: GetNatgatewayOutputArgs, opts?: InvokeOptions): Output<GetNatgatewayResult>
    def get_natgateway(datacenter_id: Optional[str] = None,
                       id: Optional[str] = None,
                       name: Optional[str] = None,
                       timeouts: Optional[GetNatgatewayTimeouts] = None,
                       opts: Optional[InvokeOptions] = None) -> GetNatgatewayResult
    def get_natgateway_output(datacenter_id: Optional[pulumi.Input[str]] = None,
                       id: Optional[pulumi.Input[str]] = None,
                       name: Optional[pulumi.Input[str]] = None,
                       timeouts: Optional[pulumi.Input[GetNatgatewayTimeoutsArgs]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetNatgatewayResult]
    func LookupNatgateway(ctx *Context, args *LookupNatgatewayArgs, opts ...InvokeOption) (*LookupNatgatewayResult, error)
    func LookupNatgatewayOutput(ctx *Context, args *LookupNatgatewayOutputArgs, opts ...InvokeOption) LookupNatgatewayResultOutput

    > Note: This function is named LookupNatgateway in the Go SDK.

    public static class GetNatgateway 
    {
        public static Task<GetNatgatewayResult> InvokeAsync(GetNatgatewayArgs args, InvokeOptions? opts = null)
        public static Output<GetNatgatewayResult> Invoke(GetNatgatewayInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetNatgatewayResult> getNatgateway(GetNatgatewayArgs args, InvokeOptions options)
    public static Output<GetNatgatewayResult> getNatgateway(GetNatgatewayArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:index/getNatgateway:getNatgateway
      arguments:
        # arguments dictionary

    The following arguments are supported:

    DatacenterId string
    Datacenter's UUID.
    Id string

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    Name string
    Name of an existing network load balancer forwarding rule that you want to search for.
    Timeouts GetNatgatewayTimeouts
    DatacenterId string
    Datacenter's UUID.
    Id string

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    Name string
    Name of an existing network load balancer forwarding rule that you want to search for.
    Timeouts GetNatgatewayTimeouts
    datacenterId String
    Datacenter's UUID.
    id String

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    name String
    Name of an existing network load balancer forwarding rule that you want to search for.
    timeouts GetNatgatewayTimeouts
    datacenterId string
    Datacenter's UUID.
    id string

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    name string
    Name of an existing network load balancer forwarding rule that you want to search for.
    timeouts GetNatgatewayTimeouts
    datacenter_id str
    Datacenter's UUID.
    id str

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    name str
    Name of an existing network load balancer forwarding rule that you want to search for.
    timeouts GetNatgatewayTimeouts
    datacenterId String
    Datacenter's UUID.
    id String

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    name String
    Name of an existing network load balancer forwarding rule that you want to search for.
    timeouts Property Map

    getNatgateway Result

    The following output properties are available:

    DatacenterId string
    Id string
    Id for the LAN connected to the NAT gateway
    Lans List<GetNatgatewayLan>
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    Name string
    Name of that natgateway
    PublicIps List<string>
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    Timeouts GetNatgatewayTimeouts
    DatacenterId string
    Id string
    Id for the LAN connected to the NAT gateway
    Lans []GetNatgatewayLan
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    Name string
    Name of that natgateway
    PublicIps []string
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    Timeouts GetNatgatewayTimeouts
    datacenterId String
    id String
    Id for the LAN connected to the NAT gateway
    lans List<GetNatgatewayLan>
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    name String
    Name of that natgateway
    publicIps List<String>
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    timeouts GetNatgatewayTimeouts
    datacenterId string
    id string
    Id for the LAN connected to the NAT gateway
    lans GetNatgatewayLan[]
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    name string
    Name of that natgateway
    publicIps string[]
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    timeouts GetNatgatewayTimeouts
    datacenter_id str
    id str
    Id for the LAN connected to the NAT gateway
    lans Sequence[GetNatgatewayLan]
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    name str
    Name of that natgateway
    public_ips Sequence[str]
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    timeouts GetNatgatewayTimeouts
    datacenterId String
    id String
    Id for the LAN connected to the NAT gateway
    lans List<Property Map>
    Collection of LANs connected to the NAT gateway. IPs must contain valid subnet mask. If user will not provide any IP then system will generate an IP with /24 subnet.
    name String
    Name of that natgateway
    publicIps List<String>
    Collection of public IP addresses of the NAT gateway. Should be customer reserved IP addresses in that location
    timeouts Property Map

    Supporting Types

    GetNatgatewayLan

    GatewayIps List<string>
    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 double

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    GatewayIps []string
    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 float64

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    gatewayIps List<String>
    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 Double

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    gatewayIps string[]
    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

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    gateway_ips Sequence[str]
    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 float

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    gatewayIps List<String>
    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

    ID of the network load balancer forwarding rule you want to search for.

    datacenter_id and either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    GetNatgatewayTimeouts

    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

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud