1. Packages
  2. Azure Classic
  3. API Docs
  4. network
  5. VirtualNetworkGatewayNatRule

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

azure.network.VirtualNetworkGatewayNatRule

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi

    Manages a Virtual Network Gateway Nat Rule.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleVirtualNetwork = new azure.network.VirtualNetwork("example", {
        name: "example-vnet",
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        addressSpaces: ["10.0.0.0/16"],
    });
    const exampleSubnet = new azure.network.Subnet("example", {
        name: "GatewaySubnet",
        resourceGroupName: exampleResourceGroup.name,
        virtualNetworkName: exampleVirtualNetwork.name,
        addressPrefixes: ["10.0.1.0/24"],
    });
    const examplePublicIp = new azure.network.PublicIp("example", {
        name: "example-pip",
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        allocationMethod: "Dynamic",
    });
    const exampleVirtualNetworkGateway = new azure.network.VirtualNetworkGateway("example", {
        name: "example-vnetgw",
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        type: "Vpn",
        vpnType: "RouteBased",
        sku: "Basic",
        ipConfigurations: [{
            publicIpAddressId: examplePublicIp.id,
            privateIpAddressAllocation: "Dynamic",
            subnetId: exampleSubnet.id,
        }],
    });
    const example = azure.network.getVirtualNetworkGatewayOutput({
        name: exampleVirtualNetworkGateway.name,
        resourceGroupName: exampleVirtualNetworkGateway.resourceGroupName,
    });
    const exampleVirtualNetworkGatewayNatRule = new azure.network.VirtualNetworkGatewayNatRule("example", {
        name: "example-vnetgwnatrule",
        resourceGroupName: exampleResourceGroup.name,
        virtualNetworkGatewayId: example.apply(example => example.id),
        mode: "EgressSnat",
        type: "Dynamic",
        ipConfigurationId: example.apply(example => example.ipConfigurations?.[0]?.id),
        externalMappings: [{
            addressSpace: "10.2.0.0/26",
            portRange: "200",
        }],
        internalMappings: [{
            addressSpace: "10.4.0.0/26",
            portRange: "400",
        }],
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_virtual_network = azure.network.VirtualNetwork("example",
        name="example-vnet",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        address_spaces=["10.0.0.0/16"])
    example_subnet = azure.network.Subnet("example",
        name="GatewaySubnet",
        resource_group_name=example_resource_group.name,
        virtual_network_name=example_virtual_network.name,
        address_prefixes=["10.0.1.0/24"])
    example_public_ip = azure.network.PublicIp("example",
        name="example-pip",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        allocation_method="Dynamic")
    example_virtual_network_gateway = azure.network.VirtualNetworkGateway("example",
        name="example-vnetgw",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        type="Vpn",
        vpn_type="RouteBased",
        sku="Basic",
        ip_configurations=[{
            "public_ip_address_id": example_public_ip.id,
            "private_ip_address_allocation": "Dynamic",
            "subnet_id": example_subnet.id,
        }])
    example = azure.network.get_virtual_network_gateway_output(name=example_virtual_network_gateway.name,
        resource_group_name=example_virtual_network_gateway.resource_group_name)
    example_virtual_network_gateway_nat_rule = azure.network.VirtualNetworkGatewayNatRule("example",
        name="example-vnetgwnatrule",
        resource_group_name=example_resource_group.name,
        virtual_network_gateway_id=example.id,
        mode="EgressSnat",
        type="Dynamic",
        ip_configuration_id=example.ip_configurations[0].id,
        external_mappings=[{
            "address_space": "10.2.0.0/26",
            "port_range": "200",
        }],
        internal_mappings=[{
            "address_space": "10.4.0.0/26",
            "port_range": "400",
        }])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v6/go/azure/network"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleResourceGroup, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetwork, err := network.NewVirtualNetwork(ctx, "example", &network.VirtualNetworkArgs{
    			Name:              pulumi.String("example-vnet"),
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			AddressSpaces: pulumi.StringArray{
    				pulumi.String("10.0.0.0/16"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		exampleSubnet, err := network.NewSubnet(ctx, "example", &network.SubnetArgs{
    			Name:               pulumi.String("GatewaySubnet"),
    			ResourceGroupName:  exampleResourceGroup.Name,
    			VirtualNetworkName: exampleVirtualNetwork.Name,
    			AddressPrefixes: pulumi.StringArray{
    				pulumi.String("10.0.1.0/24"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		examplePublicIp, err := network.NewPublicIp(ctx, "example", &network.PublicIpArgs{
    			Name:              pulumi.String("example-pip"),
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			AllocationMethod:  pulumi.String("Dynamic"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleVirtualNetworkGateway, err := network.NewVirtualNetworkGateway(ctx, "example", &network.VirtualNetworkGatewayArgs{
    			Name:              pulumi.String("example-vnetgw"),
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			Type:              pulumi.String("Vpn"),
    			VpnType:           pulumi.String("RouteBased"),
    			Sku:               pulumi.String("Basic"),
    			IpConfigurations: network.VirtualNetworkGatewayIpConfigurationArray{
    				&network.VirtualNetworkGatewayIpConfigurationArgs{
    					PublicIpAddressId:          examplePublicIp.ID(),
    					PrivateIpAddressAllocation: pulumi.String("Dynamic"),
    					SubnetId:                   exampleSubnet.ID(),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		example := network.LookupVirtualNetworkGatewayOutput(ctx, network.GetVirtualNetworkGatewayOutputArgs{
    			Name:              exampleVirtualNetworkGateway.Name,
    			ResourceGroupName: exampleVirtualNetworkGateway.ResourceGroupName,
    		}, nil)
    		_, err = network.NewVirtualNetworkGatewayNatRule(ctx, "example", &network.VirtualNetworkGatewayNatRuleArgs{
    			Name:              pulumi.String("example-vnetgwnatrule"),
    			ResourceGroupName: exampleResourceGroup.Name,
    			VirtualNetworkGatewayId: pulumi.String(example.ApplyT(func(example network.GetVirtualNetworkGatewayResult) (*string, error) {
    				return &example.Id, nil
    			}).(pulumi.StringPtrOutput)),
    			Mode: pulumi.String("EgressSnat"),
    			Type: pulumi.String("Dynamic"),
    			IpConfigurationId: pulumi.String(example.ApplyT(func(example network.GetVirtualNetworkGatewayResult) (*string, error) {
    				return &example.IpConfigurations[0].Id, nil
    			}).(pulumi.StringPtrOutput)),
    			ExternalMappings: network.VirtualNetworkGatewayNatRuleExternalMappingArray{
    				&network.VirtualNetworkGatewayNatRuleExternalMappingArgs{
    					AddressSpace: pulumi.String("10.2.0.0/26"),
    					PortRange:    pulumi.String("200"),
    				},
    			},
    			InternalMappings: network.VirtualNetworkGatewayNatRuleInternalMappingArray{
    				&network.VirtualNetworkGatewayNatRuleInternalMappingArgs{
    					AddressSpace: pulumi.String("10.4.0.0/26"),
    					PortRange:    pulumi.String("400"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleVirtualNetwork = new Azure.Network.VirtualNetwork("example", new()
        {
            Name = "example-vnet",
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            AddressSpaces = new[]
            {
                "10.0.0.0/16",
            },
        });
    
        var exampleSubnet = new Azure.Network.Subnet("example", new()
        {
            Name = "GatewaySubnet",
            ResourceGroupName = exampleResourceGroup.Name,
            VirtualNetworkName = exampleVirtualNetwork.Name,
            AddressPrefixes = new[]
            {
                "10.0.1.0/24",
            },
        });
    
        var examplePublicIp = new Azure.Network.PublicIp("example", new()
        {
            Name = "example-pip",
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            AllocationMethod = "Dynamic",
        });
    
        var exampleVirtualNetworkGateway = new Azure.Network.VirtualNetworkGateway("example", new()
        {
            Name = "example-vnetgw",
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            Type = "Vpn",
            VpnType = "RouteBased",
            Sku = "Basic",
            IpConfigurations = new[]
            {
                new Azure.Network.Inputs.VirtualNetworkGatewayIpConfigurationArgs
                {
                    PublicIpAddressId = examplePublicIp.Id,
                    PrivateIpAddressAllocation = "Dynamic",
                    SubnetId = exampleSubnet.Id,
                },
            },
        });
    
        var example = Azure.Network.GetVirtualNetworkGateway.Invoke(new()
        {
            Name = exampleVirtualNetworkGateway.Name,
            ResourceGroupName = exampleVirtualNetworkGateway.ResourceGroupName,
        });
    
        var exampleVirtualNetworkGatewayNatRule = new Azure.Network.VirtualNetworkGatewayNatRule("example", new()
        {
            Name = "example-vnetgwnatrule",
            ResourceGroupName = exampleResourceGroup.Name,
            VirtualNetworkGatewayId = example.Apply(getVirtualNetworkGatewayResult => getVirtualNetworkGatewayResult.Id),
            Mode = "EgressSnat",
            Type = "Dynamic",
            IpConfigurationId = example.Apply(getVirtualNetworkGatewayResult => getVirtualNetworkGatewayResult.IpConfigurations[0]?.Id),
            ExternalMappings = new[]
            {
                new Azure.Network.Inputs.VirtualNetworkGatewayNatRuleExternalMappingArgs
                {
                    AddressSpace = "10.2.0.0/26",
                    PortRange = "200",
                },
            },
            InternalMappings = new[]
            {
                new Azure.Network.Inputs.VirtualNetworkGatewayNatRuleInternalMappingArgs
                {
                    AddressSpace = "10.4.0.0/26",
                    PortRange = "400",
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.network.VirtualNetwork;
    import com.pulumi.azure.network.VirtualNetworkArgs;
    import com.pulumi.azure.network.Subnet;
    import com.pulumi.azure.network.SubnetArgs;
    import com.pulumi.azure.network.PublicIp;
    import com.pulumi.azure.network.PublicIpArgs;
    import com.pulumi.azure.network.VirtualNetworkGateway;
    import com.pulumi.azure.network.VirtualNetworkGatewayArgs;
    import com.pulumi.azure.network.inputs.VirtualNetworkGatewayIpConfigurationArgs;
    import com.pulumi.azure.network.NetworkFunctions;
    import com.pulumi.azure.network.inputs.GetVirtualNetworkGatewayArgs;
    import com.pulumi.azure.network.VirtualNetworkGatewayNatRule;
    import com.pulumi.azure.network.VirtualNetworkGatewayNatRuleArgs;
    import com.pulumi.azure.network.inputs.VirtualNetworkGatewayNatRuleExternalMappingArgs;
    import com.pulumi.azure.network.inputs.VirtualNetworkGatewayNatRuleInternalMappingArgs;
    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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleVirtualNetwork = new VirtualNetwork("exampleVirtualNetwork", VirtualNetworkArgs.builder()
                .name("example-vnet")
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .addressSpaces("10.0.0.0/16")
                .build());
    
            var exampleSubnet = new Subnet("exampleSubnet", SubnetArgs.builder()
                .name("GatewaySubnet")
                .resourceGroupName(exampleResourceGroup.name())
                .virtualNetworkName(exampleVirtualNetwork.name())
                .addressPrefixes("10.0.1.0/24")
                .build());
    
            var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()
                .name("example-pip")
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .allocationMethod("Dynamic")
                .build());
    
            var exampleVirtualNetworkGateway = new VirtualNetworkGateway("exampleVirtualNetworkGateway", VirtualNetworkGatewayArgs.builder()
                .name("example-vnetgw")
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .type("Vpn")
                .vpnType("RouteBased")
                .sku("Basic")
                .ipConfigurations(VirtualNetworkGatewayIpConfigurationArgs.builder()
                    .publicIpAddressId(examplePublicIp.id())
                    .privateIpAddressAllocation("Dynamic")
                    .subnetId(exampleSubnet.id())
                    .build())
                .build());
    
            final var example = NetworkFunctions.getVirtualNetworkGateway(GetVirtualNetworkGatewayArgs.builder()
                .name(exampleVirtualNetworkGateway.name())
                .resourceGroupName(exampleVirtualNetworkGateway.resourceGroupName())
                .build());
    
            var exampleVirtualNetworkGatewayNatRule = new VirtualNetworkGatewayNatRule("exampleVirtualNetworkGatewayNatRule", VirtualNetworkGatewayNatRuleArgs.builder()
                .name("example-vnetgwnatrule")
                .resourceGroupName(exampleResourceGroup.name())
                .virtualNetworkGatewayId(example.applyValue(getVirtualNetworkGatewayResult -> getVirtualNetworkGatewayResult).applyValue(example -> example.applyValue(getVirtualNetworkGatewayResult -> getVirtualNetworkGatewayResult.id())))
                .mode("EgressSnat")
                .type("Dynamic")
                .ipConfigurationId(example.applyValue(getVirtualNetworkGatewayResult -> getVirtualNetworkGatewayResult).applyValue(example -> example.applyValue(getVirtualNetworkGatewayResult -> getVirtualNetworkGatewayResult.ipConfigurations()[0].id())))
                .externalMappings(VirtualNetworkGatewayNatRuleExternalMappingArgs.builder()
                    .addressSpace("10.2.0.0/26")
                    .portRange("200")
                    .build())
                .internalMappings(VirtualNetworkGatewayNatRuleInternalMappingArgs.builder()
                    .addressSpace("10.4.0.0/26")
                    .portRange("400")
                    .build())
                .build());
    
        }
    }
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        name: example
        properties:
          name: example-resources
          location: West Europe
      exampleVirtualNetwork:
        type: azure:network:VirtualNetwork
        name: example
        properties:
          name: example-vnet
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          addressSpaces:
            - 10.0.0.0/16
      exampleSubnet:
        type: azure:network:Subnet
        name: example
        properties:
          name: GatewaySubnet
          resourceGroupName: ${exampleResourceGroup.name}
          virtualNetworkName: ${exampleVirtualNetwork.name}
          addressPrefixes:
            - 10.0.1.0/24
      examplePublicIp:
        type: azure:network:PublicIp
        name: example
        properties:
          name: example-pip
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          allocationMethod: Dynamic
      exampleVirtualNetworkGateway:
        type: azure:network:VirtualNetworkGateway
        name: example
        properties:
          name: example-vnetgw
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          type: Vpn
          vpnType: RouteBased
          sku: Basic
          ipConfigurations:
            - publicIpAddressId: ${examplePublicIp.id}
              privateIpAddressAllocation: Dynamic
              subnetId: ${exampleSubnet.id}
      exampleVirtualNetworkGatewayNatRule:
        type: azure:network:VirtualNetworkGatewayNatRule
        name: example
        properties:
          name: example-vnetgwnatrule
          resourceGroupName: ${exampleResourceGroup.name}
          virtualNetworkGatewayId: ${example.id}
          mode: EgressSnat
          type: Dynamic
          ipConfigurationId: ${example.ipConfigurations[0].id}
          externalMappings:
            - addressSpace: 10.2.0.0/26
              portRange: '200'
          internalMappings:
            - addressSpace: 10.4.0.0/26
              portRange: '400'
    variables:
      example:
        fn::invoke:
          Function: azure:network:getVirtualNetworkGateway
          Arguments:
            name: ${exampleVirtualNetworkGateway.name}
            resourceGroupName: ${exampleVirtualNetworkGateway.resourceGroupName}
    

    Create VirtualNetworkGatewayNatRule Resource

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

    Constructor syntax

    new VirtualNetworkGatewayNatRule(name: string, args: VirtualNetworkGatewayNatRuleArgs, opts?: CustomResourceOptions);
    @overload
    def VirtualNetworkGatewayNatRule(resource_name: str,
                                     args: VirtualNetworkGatewayNatRuleArgs,
                                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def VirtualNetworkGatewayNatRule(resource_name: str,
                                     opts: Optional[ResourceOptions] = None,
                                     external_mappings: Optional[Sequence[VirtualNetworkGatewayNatRuleExternalMappingArgs]] = None,
                                     internal_mappings: Optional[Sequence[VirtualNetworkGatewayNatRuleInternalMappingArgs]] = None,
                                     resource_group_name: Optional[str] = None,
                                     virtual_network_gateway_id: Optional[str] = None,
                                     ip_configuration_id: Optional[str] = None,
                                     mode: Optional[str] = None,
                                     name: Optional[str] = None,
                                     type: Optional[str] = None)
    func NewVirtualNetworkGatewayNatRule(ctx *Context, name string, args VirtualNetworkGatewayNatRuleArgs, opts ...ResourceOption) (*VirtualNetworkGatewayNatRule, error)
    public VirtualNetworkGatewayNatRule(string name, VirtualNetworkGatewayNatRuleArgs args, CustomResourceOptions? opts = null)
    public VirtualNetworkGatewayNatRule(String name, VirtualNetworkGatewayNatRuleArgs args)
    public VirtualNetworkGatewayNatRule(String name, VirtualNetworkGatewayNatRuleArgs args, CustomResourceOptions options)
    
    type: azure:network:VirtualNetworkGatewayNatRule
    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 VirtualNetworkGatewayNatRuleArgs
    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 VirtualNetworkGatewayNatRuleArgs
    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 VirtualNetworkGatewayNatRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args VirtualNetworkGatewayNatRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args VirtualNetworkGatewayNatRuleArgs
    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 virtualNetworkGatewayNatRuleResource = new Azure.Network.VirtualNetworkGatewayNatRule("virtualNetworkGatewayNatRuleResource", new()
    {
        ExternalMappings = new[]
        {
            new Azure.Network.Inputs.VirtualNetworkGatewayNatRuleExternalMappingArgs
            {
                AddressSpace = "string",
                PortRange = "string",
            },
        },
        InternalMappings = new[]
        {
            new Azure.Network.Inputs.VirtualNetworkGatewayNatRuleInternalMappingArgs
            {
                AddressSpace = "string",
                PortRange = "string",
            },
        },
        ResourceGroupName = "string",
        VirtualNetworkGatewayId = "string",
        IpConfigurationId = "string",
        Mode = "string",
        Name = "string",
        Type = "string",
    });
    
    example, err := network.NewVirtualNetworkGatewayNatRule(ctx, "virtualNetworkGatewayNatRuleResource", &network.VirtualNetworkGatewayNatRuleArgs{
    	ExternalMappings: network.VirtualNetworkGatewayNatRuleExternalMappingArray{
    		&network.VirtualNetworkGatewayNatRuleExternalMappingArgs{
    			AddressSpace: pulumi.String("string"),
    			PortRange:    pulumi.String("string"),
    		},
    	},
    	InternalMappings: network.VirtualNetworkGatewayNatRuleInternalMappingArray{
    		&network.VirtualNetworkGatewayNatRuleInternalMappingArgs{
    			AddressSpace: pulumi.String("string"),
    			PortRange:    pulumi.String("string"),
    		},
    	},
    	ResourceGroupName:       pulumi.String("string"),
    	VirtualNetworkGatewayId: pulumi.String("string"),
    	IpConfigurationId:       pulumi.String("string"),
    	Mode:                    pulumi.String("string"),
    	Name:                    pulumi.String("string"),
    	Type:                    pulumi.String("string"),
    })
    
    var virtualNetworkGatewayNatRuleResource = new VirtualNetworkGatewayNatRule("virtualNetworkGatewayNatRuleResource", VirtualNetworkGatewayNatRuleArgs.builder()
        .externalMappings(VirtualNetworkGatewayNatRuleExternalMappingArgs.builder()
            .addressSpace("string")
            .portRange("string")
            .build())
        .internalMappings(VirtualNetworkGatewayNatRuleInternalMappingArgs.builder()
            .addressSpace("string")
            .portRange("string")
            .build())
        .resourceGroupName("string")
        .virtualNetworkGatewayId("string")
        .ipConfigurationId("string")
        .mode("string")
        .name("string")
        .type("string")
        .build());
    
    virtual_network_gateway_nat_rule_resource = azure.network.VirtualNetworkGatewayNatRule("virtualNetworkGatewayNatRuleResource",
        external_mappings=[{
            "addressSpace": "string",
            "portRange": "string",
        }],
        internal_mappings=[{
            "addressSpace": "string",
            "portRange": "string",
        }],
        resource_group_name="string",
        virtual_network_gateway_id="string",
        ip_configuration_id="string",
        mode="string",
        name="string",
        type="string")
    
    const virtualNetworkGatewayNatRuleResource = new azure.network.VirtualNetworkGatewayNatRule("virtualNetworkGatewayNatRuleResource", {
        externalMappings: [{
            addressSpace: "string",
            portRange: "string",
        }],
        internalMappings: [{
            addressSpace: "string",
            portRange: "string",
        }],
        resourceGroupName: "string",
        virtualNetworkGatewayId: "string",
        ipConfigurationId: "string",
        mode: "string",
        name: "string",
        type: "string",
    });
    
    type: azure:network:VirtualNetworkGatewayNatRule
    properties:
        externalMappings:
            - addressSpace: string
              portRange: string
        internalMappings:
            - addressSpace: string
              portRange: string
        ipConfigurationId: string
        mode: string
        name: string
        resourceGroupName: string
        type: string
        virtualNetworkGatewayId: string
    

    VirtualNetworkGatewayNatRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The VirtualNetworkGatewayNatRule resource accepts the following input properties:

    ExternalMappings List<VirtualNetworkGatewayNatRuleExternalMapping>
    One or more external_mapping blocks as documented below.
    InternalMappings List<VirtualNetworkGatewayNatRuleInternalMapping>
    One or more internal_mapping blocks as documented below.
    ResourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    VirtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    IpConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    Mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    Type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    ExternalMappings []VirtualNetworkGatewayNatRuleExternalMappingArgs
    One or more external_mapping blocks as documented below.
    InternalMappings []VirtualNetworkGatewayNatRuleInternalMappingArgs
    One or more internal_mapping blocks as documented below.
    ResourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    VirtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    IpConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    Mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    Type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    externalMappings List<VirtualNetworkGatewayNatRuleExternalMapping>
    One or more external_mapping blocks as documented below.
    internalMappings List<VirtualNetworkGatewayNatRuleInternalMapping>
    One or more internal_mapping blocks as documented below.
    resourceGroupName String
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    virtualNetworkGatewayId String
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    ipConfigurationId String
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode String
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    type String
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    externalMappings VirtualNetworkGatewayNatRuleExternalMapping[]
    One or more external_mapping blocks as documented below.
    internalMappings VirtualNetworkGatewayNatRuleInternalMapping[]
    One or more internal_mapping blocks as documented below.
    resourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    virtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    ipConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    external_mappings Sequence[VirtualNetworkGatewayNatRuleExternalMappingArgs]
    One or more external_mapping blocks as documented below.
    internal_mappings Sequence[VirtualNetworkGatewayNatRuleInternalMappingArgs]
    One or more internal_mapping blocks as documented below.
    resource_group_name str
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    virtual_network_gateway_id str
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    ip_configuration_id str
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode str
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name str
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    type str
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    externalMappings List<Property Map>
    One or more external_mapping blocks as documented below.
    internalMappings List<Property Map>
    One or more internal_mapping blocks as documented below.
    resourceGroupName String
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    virtualNetworkGatewayId String
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    ipConfigurationId String
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode String
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    type String
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.

    Outputs

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

    Get an existing VirtualNetworkGatewayNatRule 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?: VirtualNetworkGatewayNatRuleState, opts?: CustomResourceOptions): VirtualNetworkGatewayNatRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            external_mappings: Optional[Sequence[VirtualNetworkGatewayNatRuleExternalMappingArgs]] = None,
            internal_mappings: Optional[Sequence[VirtualNetworkGatewayNatRuleInternalMappingArgs]] = None,
            ip_configuration_id: Optional[str] = None,
            mode: Optional[str] = None,
            name: Optional[str] = None,
            resource_group_name: Optional[str] = None,
            type: Optional[str] = None,
            virtual_network_gateway_id: Optional[str] = None) -> VirtualNetworkGatewayNatRule
    func GetVirtualNetworkGatewayNatRule(ctx *Context, name string, id IDInput, state *VirtualNetworkGatewayNatRuleState, opts ...ResourceOption) (*VirtualNetworkGatewayNatRule, error)
    public static VirtualNetworkGatewayNatRule Get(string name, Input<string> id, VirtualNetworkGatewayNatRuleState? state, CustomResourceOptions? opts = null)
    public static VirtualNetworkGatewayNatRule get(String name, Output<String> id, VirtualNetworkGatewayNatRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    ExternalMappings List<VirtualNetworkGatewayNatRuleExternalMapping>
    One or more external_mapping blocks as documented below.
    InternalMappings List<VirtualNetworkGatewayNatRuleInternalMapping>
    One or more internal_mapping blocks as documented below.
    IpConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    Mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    ResourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    Type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    VirtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    ExternalMappings []VirtualNetworkGatewayNatRuleExternalMappingArgs
    One or more external_mapping blocks as documented below.
    InternalMappings []VirtualNetworkGatewayNatRuleInternalMappingArgs
    One or more internal_mapping blocks as documented below.
    IpConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    Mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    Name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    ResourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    Type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    VirtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    externalMappings List<VirtualNetworkGatewayNatRuleExternalMapping>
    One or more external_mapping blocks as documented below.
    internalMappings List<VirtualNetworkGatewayNatRuleInternalMapping>
    One or more internal_mapping blocks as documented below.
    ipConfigurationId String
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode String
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    resourceGroupName String
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    type String
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    virtualNetworkGatewayId String
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    externalMappings VirtualNetworkGatewayNatRuleExternalMapping[]
    One or more external_mapping blocks as documented below.
    internalMappings VirtualNetworkGatewayNatRuleInternalMapping[]
    One or more internal_mapping blocks as documented below.
    ipConfigurationId string
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode string
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name string
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    resourceGroupName string
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    type string
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    virtualNetworkGatewayId string
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    external_mappings Sequence[VirtualNetworkGatewayNatRuleExternalMappingArgs]
    One or more external_mapping blocks as documented below.
    internal_mappings Sequence[VirtualNetworkGatewayNatRuleInternalMappingArgs]
    One or more internal_mapping blocks as documented below.
    ip_configuration_id str
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode str
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name str
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    resource_group_name str
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    type str
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    virtual_network_gateway_id str
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.
    externalMappings List<Property Map>
    One or more external_mapping blocks as documented below.
    internalMappings List<Property Map>
    One or more internal_mapping blocks as documented below.
    ipConfigurationId String
    The ID of the IP Configuration this Virtual Network Gateway Nat Rule applies to.
    mode String
    The source Nat direction of the Virtual Network Gateway Nat. Possible values are EgressSnat and IngressSnat. Defaults to EgressSnat. Changing this forces a new resource to be created.
    name String
    The name which should be used for this Virtual Network Gateway Nat Rule. Changing this forces a new resource to be created.
    resourceGroupName String
    The Name of the Resource Group in which this Virtual Network Gateway Nat Rule should be created. Changing this forces a new resource to be created.
    type String
    The type of the Virtual Network Gateway Nat Rule. Possible values are Dynamic and Static. Defaults to Static. Changing this forces a new resource to be created.
    virtualNetworkGatewayId String
    The ID of the Virtual Network Gateway that this Virtual Network Gateway Nat Rule belongs to. Changing this forces a new resource to be created.

    Supporting Types

    VirtualNetworkGatewayNatRuleExternalMapping, VirtualNetworkGatewayNatRuleExternalMappingArgs

    AddressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    PortRange string
    The single port range for the Virtual Network Gateway Nat Rule external mapping.
    AddressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    PortRange string
    The single port range for the Virtual Network Gateway Nat Rule external mapping.
    addressSpace String
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    portRange String
    The single port range for the Virtual Network Gateway Nat Rule external mapping.
    addressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    portRange string
    The single port range for the Virtual Network Gateway Nat Rule external mapping.
    address_space str
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    port_range str
    The single port range for the Virtual Network Gateway Nat Rule external mapping.
    addressSpace String
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule external mapping.
    portRange String
    The single port range for the Virtual Network Gateway Nat Rule external mapping.

    VirtualNetworkGatewayNatRuleInternalMapping, VirtualNetworkGatewayNatRuleInternalMappingArgs

    AddressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    PortRange string
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.
    AddressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    PortRange string
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.
    addressSpace String
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    portRange String
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.
    addressSpace string
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    portRange string
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.
    address_space str
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    port_range str
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.
    addressSpace String
    The string CIDR representing the address space for the Virtual Network Gateway Nat Rule internal mapping.
    portRange String
    The single port range for the Virtual Network Gateway Nat Rule internal mapping.

    Import

    Virtual Network Gateway Nat Rules can be imported using the resource id, e.g.

    $ pulumi import azure:network/virtualNetworkGatewayNatRule:VirtualNetworkGatewayNatRule example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resGroup1/providers/Microsoft.Network/virtualNetworkGateways/gw1/natRules/rule1
    

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v6.2.0 published on Friday, Sep 27, 2024 by Pulumi