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

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

azure.network.NatGatewayPublicIpAssociation

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi

    Manages the association between a NAT Gateway and a Public IP.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleResourceGroup = new Azure.Core.ResourceGroup("exampleResourceGroup", new()
        {
            Location = "West Europe",
        });
    
        var examplePublicIp = new Azure.Network.PublicIp("examplePublicIp", new()
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            AllocationMethod = "Static",
            Sku = "Standard",
        });
    
        var exampleNatGateway = new Azure.Network.NatGateway("exampleNatGateway", new()
        {
            Location = exampleResourceGroup.Location,
            ResourceGroupName = exampleResourceGroup.Name,
            SkuName = "Standard",
        });
    
        var exampleNatGatewayPublicIpAssociation = new Azure.Network.NatGatewayPublicIpAssociation("exampleNatGatewayPublicIpAssociation", new()
        {
            NatGatewayId = exampleNatGateway.Id,
            PublicIpAddressId = examplePublicIp.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/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, "exampleResourceGroup", &core.ResourceGroupArgs{
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		examplePublicIp, err := network.NewPublicIp(ctx, "examplePublicIp", &network.PublicIpArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			AllocationMethod:  pulumi.String("Static"),
    			Sku:               pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleNatGateway, err := network.NewNatGateway(ctx, "exampleNatGateway", &network.NatGatewayArgs{
    			Location:          exampleResourceGroup.Location,
    			ResourceGroupName: exampleResourceGroup.Name,
    			SkuName:           pulumi.String("Standard"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = network.NewNatGatewayPublicIpAssociation(ctx, "exampleNatGatewayPublicIpAssociation", &network.NatGatewayPublicIpAssociationArgs{
    			NatGatewayId:      exampleNatGateway.ID(),
    			PublicIpAddressId: examplePublicIp.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.PublicIp;
    import com.pulumi.azure.network.PublicIpArgs;
    import com.pulumi.azure.network.NatGateway;
    import com.pulumi.azure.network.NatGatewayArgs;
    import com.pulumi.azure.network.NatGatewayPublicIpAssociation;
    import com.pulumi.azure.network.NatGatewayPublicIpAssociationArgs;
    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()        
                .location("West Europe")
                .build());
    
            var examplePublicIp = new PublicIp("examplePublicIp", PublicIpArgs.builder()        
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .allocationMethod("Static")
                .sku("Standard")
                .build());
    
            var exampleNatGateway = new NatGateway("exampleNatGateway", NatGatewayArgs.builder()        
                .location(exampleResourceGroup.location())
                .resourceGroupName(exampleResourceGroup.name())
                .skuName("Standard")
                .build());
    
            var exampleNatGatewayPublicIpAssociation = new NatGatewayPublicIpAssociation("exampleNatGatewayPublicIpAssociation", NatGatewayPublicIpAssociationArgs.builder()        
                .natGatewayId(exampleNatGateway.id())
                .publicIpAddressId(examplePublicIp.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_azure as azure
    
    example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
    example_public_ip = azure.network.PublicIp("examplePublicIp",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        allocation_method="Static",
        sku="Standard")
    example_nat_gateway = azure.network.NatGateway("exampleNatGateway",
        location=example_resource_group.location,
        resource_group_name=example_resource_group.name,
        sku_name="Standard")
    example_nat_gateway_public_ip_association = azure.network.NatGatewayPublicIpAssociation("exampleNatGatewayPublicIpAssociation",
        nat_gateway_id=example_nat_gateway.id,
        public_ip_address_id=example_public_ip.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
    const examplePublicIp = new azure.network.PublicIp("examplePublicIp", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        allocationMethod: "Static",
        sku: "Standard",
    });
    const exampleNatGateway = new azure.network.NatGateway("exampleNatGateway", {
        location: exampleResourceGroup.location,
        resourceGroupName: exampleResourceGroup.name,
        skuName: "Standard",
    });
    const exampleNatGatewayPublicIpAssociation = new azure.network.NatGatewayPublicIpAssociation("exampleNatGatewayPublicIpAssociation", {
        natGatewayId: exampleNatGateway.id,
        publicIpAddressId: examplePublicIp.id,
    });
    
    resources:
      exampleResourceGroup:
        type: azure:core:ResourceGroup
        properties:
          location: West Europe
      examplePublicIp:
        type: azure:network:PublicIp
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          allocationMethod: Static
          sku: Standard
      exampleNatGateway:
        type: azure:network:NatGateway
        properties:
          location: ${exampleResourceGroup.location}
          resourceGroupName: ${exampleResourceGroup.name}
          skuName: Standard
      exampleNatGatewayPublicIpAssociation:
        type: azure:network:NatGatewayPublicIpAssociation
        properties:
          natGatewayId: ${exampleNatGateway.id}
          publicIpAddressId: ${examplePublicIp.id}
    

    Create NatGatewayPublicIpAssociation Resource

    new NatGatewayPublicIpAssociation(name: string, args: NatGatewayPublicIpAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def NatGatewayPublicIpAssociation(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      nat_gateway_id: Optional[str] = None,
                                      public_ip_address_id: Optional[str] = None)
    @overload
    def NatGatewayPublicIpAssociation(resource_name: str,
                                      args: NatGatewayPublicIpAssociationArgs,
                                      opts: Optional[ResourceOptions] = None)
    func NewNatGatewayPublicIpAssociation(ctx *Context, name string, args NatGatewayPublicIpAssociationArgs, opts ...ResourceOption) (*NatGatewayPublicIpAssociation, error)
    public NatGatewayPublicIpAssociation(string name, NatGatewayPublicIpAssociationArgs args, CustomResourceOptions? opts = null)
    public NatGatewayPublicIpAssociation(String name, NatGatewayPublicIpAssociationArgs args)
    public NatGatewayPublicIpAssociation(String name, NatGatewayPublicIpAssociationArgs args, CustomResourceOptions options)
    
    type: azure:network:NatGatewayPublicIpAssociation
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args NatGatewayPublicIpAssociationArgs
    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 NatGatewayPublicIpAssociationArgs
    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 NatGatewayPublicIpAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NatGatewayPublicIpAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NatGatewayPublicIpAssociationArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    NatGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    PublicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    NatGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    PublicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId String

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId String

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    nat_gateway_id str

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    public_ip_address_id str

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId String

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId String

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    Outputs

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

    Get an existing NatGatewayPublicIpAssociation 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?: NatGatewayPublicIpAssociationState, opts?: CustomResourceOptions): NatGatewayPublicIpAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            nat_gateway_id: Optional[str] = None,
            public_ip_address_id: Optional[str] = None) -> NatGatewayPublicIpAssociation
    func GetNatGatewayPublicIpAssociation(ctx *Context, name string, id IDInput, state *NatGatewayPublicIpAssociationState, opts ...ResourceOption) (*NatGatewayPublicIpAssociation, error)
    public static NatGatewayPublicIpAssociation Get(string name, Input<string> id, NatGatewayPublicIpAssociationState? state, CustomResourceOptions? opts = null)
    public static NatGatewayPublicIpAssociation get(String name, Output<String> id, NatGatewayPublicIpAssociationState 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:
    NatGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    PublicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    NatGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    PublicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId String

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId String

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId string

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId string

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    nat_gateway_id str

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    public_ip_address_id str

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    natGatewayId String

    The ID of the NAT Gateway. Changing this forces a new resource to be created.

    publicIpAddressId String

    The ID of the Public IP which this NAT Gateway which should be connected to. Changing this forces a new resource to be created.

    Import

    Associations between NAT Gateway and Public IP Addresses can be imported using the resource id, e.g.

     $ pulumi import azure:network/natGatewayPublicIpAssociation:NatGatewayPublicIpAssociation example "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Network/natGateways/gateway1|/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Network/publicIPAddresses/myPublicIpAddress1"
    

    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 v5.58.0 published on Saturday, Dec 2, 2023 by Pulumi