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

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.network.NatGatewayPublicIpAssociation

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

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

    Example Usage

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

    Create NatGatewayPublicIpAssociation Resource

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

    Constructor syntax

    new NatGatewayPublicIpAssociation(name: string, args: NatGatewayPublicIpAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def NatGatewayPublicIpAssociation(resource_name: str,
                                      args: NatGatewayPublicIpAssociationArgs,
                                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def NatGatewayPublicIpAssociation(resource_name: str,
                                      opts: Optional[ResourceOptions] = None,
                                      nat_gateway_id: Optional[str] = None,
                                      public_ip_address_id: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var natGatewayPublicIpAssociationResource = new Azure.Network.NatGatewayPublicIpAssociation("natGatewayPublicIpAssociationResource", new()
    {
        NatGatewayId = "string",
        PublicIpAddressId = "string",
    });
    
    example, err := network.NewNatGatewayPublicIpAssociation(ctx, "natGatewayPublicIpAssociationResource", &network.NatGatewayPublicIpAssociationArgs{
    	NatGatewayId:      pulumi.String("string"),
    	PublicIpAddressId: pulumi.String("string"),
    })
    
    var natGatewayPublicIpAssociationResource = new NatGatewayPublicIpAssociation("natGatewayPublicIpAssociationResource", NatGatewayPublicIpAssociationArgs.builder()
        .natGatewayId("string")
        .publicIpAddressId("string")
        .build());
    
    nat_gateway_public_ip_association_resource = azure.network.NatGatewayPublicIpAssociation("natGatewayPublicIpAssociationResource",
        nat_gateway_id="string",
        public_ip_address_id="string")
    
    const natGatewayPublicIpAssociationResource = new azure.network.NatGatewayPublicIpAssociation("natGatewayPublicIpAssociationResource", {
        natGatewayId: "string",
        publicIpAddressId: "string",
    });
    
    type: azure:network:NatGatewayPublicIpAssociation
    properties:
        natGatewayId: string
        publicIpAddressId: string
    

    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"
    

    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 v5.81.0 published on Monday, Jun 24, 2024 by Pulumi