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

ionoscloud.NatgatewayRule

Explore with Pulumi AI

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

    Manages a Nat Gateway Rule 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": false,
    });
    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"],
        }],
    });
    const exampleNatgatewayRule = new ionoscloud.NatgatewayRule("exampleNatgatewayRule", {
        datacenterId: exampleDatacenter.datacenterId,
        natgatewayId: exampleNatgateway.natgatewayId,
        type: "SNAT",
        protocol: "TCP",
        sourceSubnet: "10.0.1.0/24",
        publicIp: exampleIpblock.ips[0],
        targetSubnet: "10.0.1.0/24",
        targetPortRange: {
            start: 500,
            end: 1000,
        },
    });
    
    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=False)
    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"],
        }])
    example_natgateway_rule = ionoscloud.NatgatewayRule("exampleNatgatewayRule",
        datacenter_id=example_datacenter.datacenter_id,
        natgateway_id=example_natgateway.natgateway_id,
        type="SNAT",
        protocol="TCP",
        source_subnet="10.0.1.0/24",
        public_ip=example_ipblock.ips[0],
        target_subnet="10.0.1.0/24",
        target_port_range={
            "start": 500,
            "end": 1000,
        })
    
    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(false),
    		})
    		if err != nil {
    			return err
    		}
    		exampleNatgateway, 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
    		}
    		_, err = ionoscloud.NewNatgatewayRule(ctx, "exampleNatgatewayRule", &ionoscloud.NatgatewayRuleArgs{
    			DatacenterId: exampleDatacenter.DatacenterId,
    			NatgatewayId: exampleNatgateway.NatgatewayId,
    			Type:         pulumi.String("SNAT"),
    			Protocol:     pulumi.String("TCP"),
    			SourceSubnet: pulumi.String("10.0.1.0/24"),
    			PublicIp: exampleIpblock.Ips.ApplyT(func(ips []string) (string, error) {
    				return ips[0], nil
    			}).(pulumi.StringOutput),
    			TargetSubnet: pulumi.String("10.0.1.0/24"),
    			TargetPortRange: &ionoscloud.NatgatewayRuleTargetPortRangeArgs{
    				Start: pulumi.Float64(500),
    				End:   pulumi.Float64(1000),
    			},
    		})
    		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 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 = false,
        });
    
        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",
                    },
                },
            },
        });
    
        var exampleNatgatewayRule = new Ionoscloud.NatgatewayRule("exampleNatgatewayRule", new()
        {
            DatacenterId = exampleDatacenter.DatacenterId,
            NatgatewayId = exampleNatgateway.NatgatewayId,
            Type = "SNAT",
            Protocol = "TCP",
            SourceSubnet = "10.0.1.0/24",
            PublicIp = exampleIpblock.Ips.Apply(ips => ips[0]),
            TargetSubnet = "10.0.1.0/24",
            TargetPortRange = new Ionoscloud.Inputs.NatgatewayRuleTargetPortRangeArgs
            {
                Start = 500,
                End = 1000,
            },
        });
    
    });
    
    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 com.pulumi.ionoscloud.NatgatewayRule;
    import com.pulumi.ionoscloud.NatgatewayRuleArgs;
    import com.pulumi.ionoscloud.inputs.NatgatewayRuleTargetPortRangeArgs;
    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_(false)
                .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());
    
            var exampleNatgatewayRule = new NatgatewayRule("exampleNatgatewayRule", NatgatewayRuleArgs.builder()
                .datacenterId(exampleDatacenter.datacenterId())
                .natgatewayId(exampleNatgateway.natgatewayId())
                .type("SNAT")
                .protocol("TCP")
                .sourceSubnet("10.0.1.0/24")
                .publicIp(exampleIpblock.ips().applyValue(ips -> ips[0]))
                .targetSubnet("10.0.1.0/24")
                .targetPortRange(NatgatewayRuleTargetPortRangeArgs.builder()
                    .start(500)
                    .end(1000)
                    .build())
                .build());
    
        }
    }
    
    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: false
      exampleNatgateway:
        type: ionoscloud:Natgateway
        properties:
          datacenterId: ${exampleDatacenter.datacenterId}
          publicIps:
            - ${exampleIpblock.ips[0]}
            - ${exampleIpblock.ips[1]}
          lans:
            - id: ${exampleLan.lanId}
              gatewayIps:
                - 10.11.2.5
      exampleNatgatewayRule:
        type: ionoscloud:NatgatewayRule
        properties:
          datacenterId: ${exampleDatacenter.datacenterId}
          natgatewayId: ${exampleNatgateway.natgatewayId}
          type: SNAT
          protocol: TCP
          sourceSubnet: 10.0.1.0/24
          publicIp: ${exampleIpblock.ips[0]}
          targetSubnet: 10.0.1.0/24
          targetPortRange:
            start: 500
            end: 1000
    

    Create NatgatewayRule Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new NatgatewayRule(name: string, args: NatgatewayRuleArgs, opts?: CustomResourceOptions);
    @overload
    def NatgatewayRule(resource_name: str,
                       args: NatgatewayRuleArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def NatgatewayRule(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       datacenter_id: Optional[str] = None,
                       natgateway_id: Optional[str] = None,
                       public_ip: Optional[str] = None,
                       source_subnet: Optional[str] = None,
                       name: Optional[str] = None,
                       natgateway_rule_id: Optional[str] = None,
                       protocol: Optional[str] = None,
                       target_port_range: Optional[NatgatewayRuleTargetPortRangeArgs] = None,
                       target_subnet: Optional[str] = None,
                       timeouts: Optional[NatgatewayRuleTimeoutsArgs] = None,
                       type: Optional[str] = None)
    func NewNatgatewayRule(ctx *Context, name string, args NatgatewayRuleArgs, opts ...ResourceOption) (*NatgatewayRule, error)
    public NatgatewayRule(string name, NatgatewayRuleArgs args, CustomResourceOptions? opts = null)
    public NatgatewayRule(String name, NatgatewayRuleArgs args)
    public NatgatewayRule(String name, NatgatewayRuleArgs args, CustomResourceOptions options)
    
    type: ionoscloud:NatgatewayRule
    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 NatgatewayRuleArgs
    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 NatgatewayRuleArgs
    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 NatgatewayRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NatgatewayRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NatgatewayRuleArgs
    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 natgatewayRuleResource = new Ionoscloud.NatgatewayRule("natgatewayRuleResource", new()
    {
        DatacenterId = "string",
        NatgatewayId = "string",
        PublicIp = "string",
        SourceSubnet = "string",
        Name = "string",
        NatgatewayRuleId = "string",
        Protocol = "string",
        TargetPortRange = new Ionoscloud.Inputs.NatgatewayRuleTargetPortRangeArgs
        {
            End = 0,
            Start = 0,
        },
        TargetSubnet = "string",
        Timeouts = new Ionoscloud.Inputs.NatgatewayRuleTimeoutsArgs
        {
            Create = "string",
            Default = "string",
            Delete = "string",
            Update = "string",
        },
        Type = "string",
    });
    
    example, err := ionoscloud.NewNatgatewayRule(ctx, "natgatewayRuleResource", &ionoscloud.NatgatewayRuleArgs{
    	DatacenterId:     pulumi.String("string"),
    	NatgatewayId:     pulumi.String("string"),
    	PublicIp:         pulumi.String("string"),
    	SourceSubnet:     pulumi.String("string"),
    	Name:             pulumi.String("string"),
    	NatgatewayRuleId: pulumi.String("string"),
    	Protocol:         pulumi.String("string"),
    	TargetPortRange: &ionoscloud.NatgatewayRuleTargetPortRangeArgs{
    		End:   pulumi.Float64(0),
    		Start: pulumi.Float64(0),
    	},
    	TargetSubnet: pulumi.String("string"),
    	Timeouts: &ionoscloud.NatgatewayRuleTimeoutsArgs{
    		Create:  pulumi.String("string"),
    		Default: pulumi.String("string"),
    		Delete:  pulumi.String("string"),
    		Update:  pulumi.String("string"),
    	},
    	Type: pulumi.String("string"),
    })
    
    var natgatewayRuleResource = new NatgatewayRule("natgatewayRuleResource", NatgatewayRuleArgs.builder()
        .datacenterId("string")
        .natgatewayId("string")
        .publicIp("string")
        .sourceSubnet("string")
        .name("string")
        .natgatewayRuleId("string")
        .protocol("string")
        .targetPortRange(NatgatewayRuleTargetPortRangeArgs.builder()
            .end(0)
            .start(0)
            .build())
        .targetSubnet("string")
        .timeouts(NatgatewayRuleTimeoutsArgs.builder()
            .create("string")
            .default_("string")
            .delete("string")
            .update("string")
            .build())
        .type("string")
        .build());
    
    natgateway_rule_resource = ionoscloud.NatgatewayRule("natgatewayRuleResource",
        datacenter_id="string",
        natgateway_id="string",
        public_ip="string",
        source_subnet="string",
        name="string",
        natgateway_rule_id="string",
        protocol="string",
        target_port_range={
            "end": 0,
            "start": 0,
        },
        target_subnet="string",
        timeouts={
            "create": "string",
            "default": "string",
            "delete": "string",
            "update": "string",
        },
        type="string")
    
    const natgatewayRuleResource = new ionoscloud.NatgatewayRule("natgatewayRuleResource", {
        datacenterId: "string",
        natgatewayId: "string",
        publicIp: "string",
        sourceSubnet: "string",
        name: "string",
        natgatewayRuleId: "string",
        protocol: "string",
        targetPortRange: {
            end: 0,
            start: 0,
        },
        targetSubnet: "string",
        timeouts: {
            create: "string",
            "default": "string",
            "delete": "string",
            update: "string",
        },
        type: "string",
    });
    
    type: ionoscloud:NatgatewayRule
    properties:
        datacenterId: string
        name: string
        natgatewayId: string
        natgatewayRuleId: string
        protocol: string
        publicIp: string
        sourceSubnet: string
        targetPortRange:
            end: 0
            start: 0
        targetSubnet: string
        timeouts:
            create: string
            default: string
            delete: string
            update: string
        type: string
    

    NatgatewayRule 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 NatgatewayRule resource accepts the following input properties:

    DatacenterId string
    [string] A Datacenter's UUID.
    NatgatewayId string
    [string] Nat Gateway's UUID.
    PublicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    SourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    Name string
    [string] Name of the NAT gateway rule.
    NatgatewayRuleId string
    Protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    TargetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    TargetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    Timeouts NatgatewayRuleTimeouts
    Type string
    [string] Type of the NAT gateway rule.
    DatacenterId string
    [string] A Datacenter's UUID.
    NatgatewayId string
    [string] Nat Gateway's UUID.
    PublicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    SourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    Name string
    [string] Name of the NAT gateway rule.
    NatgatewayRuleId string
    Protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    TargetPortRange NatgatewayRuleTargetPortRangeArgs
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    TargetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    Timeouts NatgatewayRuleTimeoutsArgs
    Type string
    [string] Type of the NAT gateway rule.
    datacenterId String
    [string] A Datacenter's UUID.
    natgatewayId String
    [string] Nat Gateway's UUID.
    publicIp String
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet String
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    name String
    [string] Name of the NAT gateway rule.
    natgatewayRuleId String
    protocol String
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    targetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet String
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeouts
    type String
    [string] Type of the NAT gateway rule.
    datacenterId string
    [string] A Datacenter's UUID.
    natgatewayId string
    [string] Nat Gateway's UUID.
    publicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    name string
    [string] Name of the NAT gateway rule.
    natgatewayRuleId string
    protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    targetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeouts
    type string
    [string] Type of the NAT gateway rule.
    datacenter_id str
    [string] A Datacenter's UUID.
    natgateway_id str
    [string] Nat Gateway's UUID.
    public_ip str
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    source_subnet str
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    name str
    [string] Name of the NAT gateway rule.
    natgateway_rule_id str
    protocol str
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    target_port_range NatgatewayRuleTargetPortRangeArgs
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    target_subnet str
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeoutsArgs
    type str
    [string] Type of the NAT gateway rule.
    datacenterId String
    [string] A Datacenter's UUID.
    natgatewayId String
    [string] Nat Gateway's UUID.
    publicIp String
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet String
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    name String
    [string] Name of the NAT gateway rule.
    natgatewayRuleId String
    protocol String
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    targetPortRange Property Map
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet String
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts Property Map
    type String
    [string] Type of the NAT gateway rule.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the NatgatewayRule 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 NatgatewayRule Resource

    Get an existing NatgatewayRule 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?: NatgatewayRuleState, opts?: CustomResourceOptions): NatgatewayRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            datacenter_id: Optional[str] = None,
            name: Optional[str] = None,
            natgateway_id: Optional[str] = None,
            natgateway_rule_id: Optional[str] = None,
            protocol: Optional[str] = None,
            public_ip: Optional[str] = None,
            source_subnet: Optional[str] = None,
            target_port_range: Optional[NatgatewayRuleTargetPortRangeArgs] = None,
            target_subnet: Optional[str] = None,
            timeouts: Optional[NatgatewayRuleTimeoutsArgs] = None,
            type: Optional[str] = None) -> NatgatewayRule
    func GetNatgatewayRule(ctx *Context, name string, id IDInput, state *NatgatewayRuleState, opts ...ResourceOption) (*NatgatewayRule, error)
    public static NatgatewayRule Get(string name, Input<string> id, NatgatewayRuleState? state, CustomResourceOptions? opts = null)
    public static NatgatewayRule get(String name, Output<String> id, NatgatewayRuleState state, CustomResourceOptions options)
    resources:  _:    type: ionoscloud:NatgatewayRule    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.
    The following state arguments are supported:
    DatacenterId string
    [string] A Datacenter's UUID.
    Name string
    [string] Name of the NAT gateway rule.
    NatgatewayId string
    [string] Nat Gateway's UUID.
    NatgatewayRuleId string
    Protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    PublicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    SourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    TargetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    TargetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    Timeouts NatgatewayRuleTimeouts
    Type string
    [string] Type of the NAT gateway rule.
    DatacenterId string
    [string] A Datacenter's UUID.
    Name string
    [string] Name of the NAT gateway rule.
    NatgatewayId string
    [string] Nat Gateway's UUID.
    NatgatewayRuleId string
    Protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    PublicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    SourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    TargetPortRange NatgatewayRuleTargetPortRangeArgs
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    TargetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    Timeouts NatgatewayRuleTimeoutsArgs
    Type string
    [string] Type of the NAT gateway rule.
    datacenterId String
    [string] A Datacenter's UUID.
    name String
    [string] Name of the NAT gateway rule.
    natgatewayId String
    [string] Nat Gateway's UUID.
    natgatewayRuleId String
    protocol String
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    publicIp String
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet String
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    targetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet String
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeouts
    type String
    [string] Type of the NAT gateway rule.
    datacenterId string
    [string] A Datacenter's UUID.
    name string
    [string] Name of the NAT gateway rule.
    natgatewayId string
    [string] Nat Gateway's UUID.
    natgatewayRuleId string
    protocol string
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    publicIp string
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet string
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    targetPortRange NatgatewayRuleTargetPortRange
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet string
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeouts
    type string
    [string] Type of the NAT gateway rule.
    datacenter_id str
    [string] A Datacenter's UUID.
    name str
    [string] Name of the NAT gateway rule.
    natgateway_id str
    [string] Nat Gateway's UUID.
    natgateway_rule_id str
    protocol str
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    public_ip str
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    source_subnet str
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    target_port_range NatgatewayRuleTargetPortRangeArgs
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    target_subnet str
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts NatgatewayRuleTimeoutsArgs
    type str
    [string] Type of the NAT gateway rule.
    datacenterId String
    [string] A Datacenter's UUID.
    name String
    [string] Name of the NAT gateway rule.
    natgatewayId String
    [string] Nat Gateway's UUID.
    natgatewayRuleId String
    protocol String
    [string] Protocol of the NAT gateway rule. Defaults to ALL. If protocol is 'ICMP' then targetPortRange start and end cannot be set.
    publicIp String
    [string] Public IP address of the NAT gateway rule. Specifies the address used for masking outgoing packets source address field. Should be one of the customer reserved IP address already configured on the NAT gateway resource.
    sourceSubnet String
    [string] Source subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets source IP address.
    targetPortRange Property Map
    Target port range of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on destination port. If none is provided, rule will match any port.
    targetSubnet String
    [string] Target or destination subnet of the NAT gateway rule. For SNAT rules it specifies which packets this translation rule applies to based on the packets destination IP address. If none is provided, rule will match any address.
    timeouts Property Map
    type String
    [string] Type of the NAT gateway rule.

    Supporting Types

    NatgatewayRuleTargetPortRange, NatgatewayRuleTargetPortRangeArgs

    End double
    [int] Target port range end associated with the NAT gateway rule.
    Start double
    [int] Target port range start associated with the NAT gateway rule.
    End float64
    [int] Target port range end associated with the NAT gateway rule.
    Start float64
    [int] Target port range start associated with the NAT gateway rule.
    end Double
    [int] Target port range end associated with the NAT gateway rule.
    start Double
    [int] Target port range start associated with the NAT gateway rule.
    end number
    [int] Target port range end associated with the NAT gateway rule.
    start number
    [int] Target port range start associated with the NAT gateway rule.
    end float
    [int] Target port range end associated with the NAT gateway rule.
    start float
    [int] Target port range start associated with the NAT gateway rule.
    end Number
    [int] Target port range end associated with the NAT gateway rule.
    start Number
    [int] Target port range start associated with the NAT gateway rule.

    NatgatewayRuleTimeouts, NatgatewayRuleTimeoutsArgs

    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 Rule resource can be imported using its resource id, the datacenter id and the `natgateway id , e.g.

    $ pulumi import ionoscloud:index/natgatewayRule:NatgatewayRule my_natgateway_rule datacenter uuid/nat gateway uuid/nat gateway rule uuid
    

    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.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud