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

We recommend using Azure Native.

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

azure.network.NatGatewayPublicIpPrefixAssociation

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 Prefix.

    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 examplePublicIpPrefix = new azure.network.PublicIpPrefix("example", {
        name: "example",
        location: example.location,
        resourceGroupName: example.name,
        prefixLength: 30,
        zones: ["1"],
    });
    const exampleNatGateway = new azure.network.NatGateway("example", {
        name: "example-NatGateway",
        location: example.location,
        resourceGroupName: example.name,
        skuName: "Standard",
    });
    const exampleNatGatewayPublicIpPrefixAssociation = new azure.network.NatGatewayPublicIpPrefixAssociation("example", {
        natGatewayId: exampleNatGateway.id,
        publicIpPrefixId: examplePublicIpPrefix.id,
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_public_ip_prefix = azure.network.PublicIpPrefix("example",
        name="example",
        location=example.location,
        resource_group_name=example.name,
        prefix_length=30,
        zones=["1"])
    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_prefix_association = azure.network.NatGatewayPublicIpPrefixAssociation("example",
        nat_gateway_id=example_nat_gateway.id,
        public_ip_prefix_id=example_public_ip_prefix.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
    		}
    		examplePublicIpPrefix, err := network.NewPublicIpPrefix(ctx, "example", &network.PublicIpPrefixArgs{
    			Name:              pulumi.String("example"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			PrefixLength:      pulumi.Int(30),
    			Zones: pulumi.StringArray{
    				pulumi.String("1"),
    			},
    		})
    		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.NewNatGatewayPublicIpPrefixAssociation(ctx, "example", &network.NatGatewayPublicIpPrefixAssociationArgs{
    			NatGatewayId:     exampleNatGateway.ID(),
    			PublicIpPrefixId: examplePublicIpPrefix.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 examplePublicIpPrefix = new Azure.Network.PublicIpPrefix("example", new()
        {
            Name = "example",
            Location = example.Location,
            ResourceGroupName = example.Name,
            PrefixLength = 30,
            Zones = new[]
            {
                "1",
            },
        });
    
        var exampleNatGateway = new Azure.Network.NatGateway("example", new()
        {
            Name = "example-NatGateway",
            Location = example.Location,
            ResourceGroupName = example.Name,
            SkuName = "Standard",
        });
    
        var exampleNatGatewayPublicIpPrefixAssociation = new Azure.Network.NatGatewayPublicIpPrefixAssociation("example", new()
        {
            NatGatewayId = exampleNatGateway.Id,
            PublicIpPrefixId = examplePublicIpPrefix.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.PublicIpPrefix;
    import com.pulumi.azure.network.PublicIpPrefixArgs;
    import com.pulumi.azure.network.NatGateway;
    import com.pulumi.azure.network.NatGatewayArgs;
    import com.pulumi.azure.network.NatGatewayPublicIpPrefixAssociation;
    import com.pulumi.azure.network.NatGatewayPublicIpPrefixAssociationArgs;
    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 examplePublicIpPrefix = new PublicIpPrefix("examplePublicIpPrefix", PublicIpPrefixArgs.builder()
                .name("example")
                .location(example.location())
                .resourceGroupName(example.name())
                .prefixLength(30)
                .zones("1")
                .build());
    
            var exampleNatGateway = new NatGateway("exampleNatGateway", NatGatewayArgs.builder()
                .name("example-NatGateway")
                .location(example.location())
                .resourceGroupName(example.name())
                .skuName("Standard")
                .build());
    
            var exampleNatGatewayPublicIpPrefixAssociation = new NatGatewayPublicIpPrefixAssociation("exampleNatGatewayPublicIpPrefixAssociation", NatGatewayPublicIpPrefixAssociationArgs.builder()
                .natGatewayId(exampleNatGateway.id())
                .publicIpPrefixId(examplePublicIpPrefix.id())
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      examplePublicIpPrefix:
        type: azure:network:PublicIpPrefix
        name: example
        properties:
          name: example
          location: ${example.location}
          resourceGroupName: ${example.name}
          prefixLength: 30
          zones:
            - '1'
      exampleNatGateway:
        type: azure:network:NatGateway
        name: example
        properties:
          name: example-NatGateway
          location: ${example.location}
          resourceGroupName: ${example.name}
          skuName: Standard
      exampleNatGatewayPublicIpPrefixAssociation:
        type: azure:network:NatGatewayPublicIpPrefixAssociation
        name: example
        properties:
          natGatewayId: ${exampleNatGateway.id}
          publicIpPrefixId: ${examplePublicIpPrefix.id}
    

    Create NatGatewayPublicIpPrefixAssociation Resource

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

    Constructor syntax

    new NatGatewayPublicIpPrefixAssociation(name: string, args: NatGatewayPublicIpPrefixAssociationArgs, opts?: CustomResourceOptions);
    @overload
    def NatGatewayPublicIpPrefixAssociation(resource_name: str,
                                            args: NatGatewayPublicIpPrefixAssociationArgs,
                                            opts: Optional[ResourceOptions] = None)
    
    @overload
    def NatGatewayPublicIpPrefixAssociation(resource_name: str,
                                            opts: Optional[ResourceOptions] = None,
                                            nat_gateway_id: Optional[str] = None,
                                            public_ip_prefix_id: Optional[str] = None)
    func NewNatGatewayPublicIpPrefixAssociation(ctx *Context, name string, args NatGatewayPublicIpPrefixAssociationArgs, opts ...ResourceOption) (*NatGatewayPublicIpPrefixAssociation, error)
    public NatGatewayPublicIpPrefixAssociation(string name, NatGatewayPublicIpPrefixAssociationArgs args, CustomResourceOptions? opts = null)
    public NatGatewayPublicIpPrefixAssociation(String name, NatGatewayPublicIpPrefixAssociationArgs args)
    public NatGatewayPublicIpPrefixAssociation(String name, NatGatewayPublicIpPrefixAssociationArgs args, CustomResourceOptions options)
    
    type: azure:network:NatGatewayPublicIpPrefixAssociation
    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 NatGatewayPublicIpPrefixAssociationArgs
    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 NatGatewayPublicIpPrefixAssociationArgs
    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 NatGatewayPublicIpPrefixAssociationArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NatGatewayPublicIpPrefixAssociationArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NatGatewayPublicIpPrefixAssociationArgs
    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 natGatewayPublicIpPrefixAssociationResource = new Azure.Network.NatGatewayPublicIpPrefixAssociation("natGatewayPublicIpPrefixAssociationResource", new()
    {
        NatGatewayId = "string",
        PublicIpPrefixId = "string",
    });
    
    example, err := network.NewNatGatewayPublicIpPrefixAssociation(ctx, "natGatewayPublicIpPrefixAssociationResource", &network.NatGatewayPublicIpPrefixAssociationArgs{
    	NatGatewayId:     pulumi.String("string"),
    	PublicIpPrefixId: pulumi.String("string"),
    })
    
    var natGatewayPublicIpPrefixAssociationResource = new NatGatewayPublicIpPrefixAssociation("natGatewayPublicIpPrefixAssociationResource", NatGatewayPublicIpPrefixAssociationArgs.builder()
        .natGatewayId("string")
        .publicIpPrefixId("string")
        .build());
    
    nat_gateway_public_ip_prefix_association_resource = azure.network.NatGatewayPublicIpPrefixAssociation("natGatewayPublicIpPrefixAssociationResource",
        nat_gateway_id="string",
        public_ip_prefix_id="string")
    
    const natGatewayPublicIpPrefixAssociationResource = new azure.network.NatGatewayPublicIpPrefixAssociation("natGatewayPublicIpPrefixAssociationResource", {
        natGatewayId: "string",
        publicIpPrefixId: "string",
    });
    
    type: azure:network:NatGatewayPublicIpPrefixAssociation
    properties:
        natGatewayId: string
        publicIpPrefixId: string
    

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

    NatGatewayId string
    The ID of the NAT Gateway. Changing this forces a new resource to be created.
    PublicIpPrefixId string
    The ID of the Public IP Prefix 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.
    PublicIpPrefixId string
    The ID of the Public IP Prefix 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.
    publicIpPrefixId String
    The ID of the Public IP Prefix 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.
    publicIpPrefixId string
    The ID of the Public IP Prefix 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_prefix_id str
    The ID of the Public IP Prefix 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.
    publicIpPrefixId String
    The ID of the Public IP Prefix 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 NatGatewayPublicIpPrefixAssociation 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 NatGatewayPublicIpPrefixAssociation Resource

    Get an existing NatGatewayPublicIpPrefixAssociation 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?: NatGatewayPublicIpPrefixAssociationState, opts?: CustomResourceOptions): NatGatewayPublicIpPrefixAssociation
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            nat_gateway_id: Optional[str] = None,
            public_ip_prefix_id: Optional[str] = None) -> NatGatewayPublicIpPrefixAssociation
    func GetNatGatewayPublicIpPrefixAssociation(ctx *Context, name string, id IDInput, state *NatGatewayPublicIpPrefixAssociationState, opts ...ResourceOption) (*NatGatewayPublicIpPrefixAssociation, error)
    public static NatGatewayPublicIpPrefixAssociation Get(string name, Input<string> id, NatGatewayPublicIpPrefixAssociationState? state, CustomResourceOptions? opts = null)
    public static NatGatewayPublicIpPrefixAssociation get(String name, Output<String> id, NatGatewayPublicIpPrefixAssociationState 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.
    PublicIpPrefixId string
    The ID of the Public IP Prefix 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.
    PublicIpPrefixId string
    The ID of the Public IP Prefix 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.
    publicIpPrefixId String
    The ID of the Public IP Prefix 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.
    publicIpPrefixId string
    The ID of the Public IP Prefix 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_prefix_id str
    The ID of the Public IP Prefix 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.
    publicIpPrefixId String
    The ID of the Public IP Prefix 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 Prefixes can be imported using the resource id, e.g.

    $ pulumi import azure:network/natGatewayPublicIpPrefixAssociation:NatGatewayPublicIpPrefixAssociation 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/publicIPPrefixes/myPublicIpPrefix1"
    

    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