azure.network.NatGatewayPublicIpPrefixAssociation

Explore with Pulumi AI

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

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 examplePublicIpPrefix = new Azure.Network.PublicIpPrefix("examplePublicIpPrefix", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        PrefixLength = 30,
        Zones = new[]
        {
            "1",
        },
    });

    var exampleNatGateway = new Azure.Network.NatGateway("exampleNatGateway", new()
    {
        Location = exampleResourceGroup.Location,
        ResourceGroupName = exampleResourceGroup.Name,
        SkuName = "Standard",
    });

    var exampleNatGatewayPublicIpPrefixAssociation = new Azure.Network.NatGatewayPublicIpPrefixAssociation("exampleNatGatewayPublicIpPrefixAssociation", new()
    {
        NatGatewayId = exampleNatGateway.Id,
        PublicIpPrefixId = examplePublicIpPrefix.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
		}
		examplePublicIpPrefix, err := network.NewPublicIpPrefix(ctx, "examplePublicIpPrefix", &network.PublicIpPrefixArgs{
			Location:          exampleResourceGroup.Location,
			ResourceGroupName: exampleResourceGroup.Name,
			PrefixLength:      pulumi.Int(30),
			Zones: pulumi.StringArray{
				pulumi.String("1"),
			},
		})
		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.NewNatGatewayPublicIpPrefixAssociation(ctx, "exampleNatGatewayPublicIpPrefixAssociation", &network.NatGatewayPublicIpPrefixAssociationArgs{
			NatGatewayId:     exampleNatGateway.ID(),
			PublicIpPrefixId: examplePublicIpPrefix.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.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 exampleResourceGroup = new ResourceGroup("exampleResourceGroup", ResourceGroupArgs.builder()        
            .location("West Europe")
            .build());

        var examplePublicIpPrefix = new PublicIpPrefix("examplePublicIpPrefix", PublicIpPrefixArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .prefixLength(30)
            .zones("1")
            .build());

        var exampleNatGateway = new NatGateway("exampleNatGateway", NatGatewayArgs.builder()        
            .location(exampleResourceGroup.location())
            .resourceGroupName(exampleResourceGroup.name())
            .skuName("Standard")
            .build());

        var exampleNatGatewayPublicIpPrefixAssociation = new NatGatewayPublicIpPrefixAssociation("exampleNatGatewayPublicIpPrefixAssociation", NatGatewayPublicIpPrefixAssociationArgs.builder()        
            .natGatewayId(exampleNatGateway.id())
            .publicIpPrefixId(examplePublicIpPrefix.id())
            .build());

    }
}
import pulumi
import pulumi_azure as azure

example_resource_group = azure.core.ResourceGroup("exampleResourceGroup", location="West Europe")
example_public_ip_prefix = azure.network.PublicIpPrefix("examplePublicIpPrefix",
    location=example_resource_group.location,
    resource_group_name=example_resource_group.name,
    prefix_length=30,
    zones=["1"])
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_prefix_association = azure.network.NatGatewayPublicIpPrefixAssociation("exampleNatGatewayPublicIpPrefixAssociation",
    nat_gateway_id=example_nat_gateway.id,
    public_ip_prefix_id=example_public_ip_prefix.id)
import * as pulumi from "@pulumi/pulumi";
import * as azure from "@pulumi/azure";

const exampleResourceGroup = new azure.core.ResourceGroup("exampleResourceGroup", {location: "West Europe"});
const examplePublicIpPrefix = new azure.network.PublicIpPrefix("examplePublicIpPrefix", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    prefixLength: 30,
    zones: ["1"],
});
const exampleNatGateway = new azure.network.NatGateway("exampleNatGateway", {
    location: exampleResourceGroup.location,
    resourceGroupName: exampleResourceGroup.name,
    skuName: "Standard",
});
const exampleNatGatewayPublicIpPrefixAssociation = new azure.network.NatGatewayPublicIpPrefixAssociation("exampleNatGatewayPublicIpPrefixAssociation", {
    natGatewayId: exampleNatGateway.id,
    publicIpPrefixId: examplePublicIpPrefix.id,
});
resources:
  exampleResourceGroup:
    type: azure:core:ResourceGroup
    properties:
      location: West Europe
  examplePublicIpPrefix:
    type: azure:network:PublicIpPrefix
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      prefixLength: 30
      zones:
        - '1'
  exampleNatGateway:
    type: azure:network:NatGateway
    properties:
      location: ${exampleResourceGroup.location}
      resourceGroupName: ${exampleResourceGroup.name}
      skuName: Standard
  exampleNatGatewayPublicIpPrefixAssociation:
    type: azure:network:NatGatewayPublicIpPrefixAssociation
    properties:
      natGatewayId: ${exampleNatGateway.id}
      publicIpPrefixId: ${examplePublicIpPrefix.id}

Create NatGatewayPublicIpPrefixAssociation Resource

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

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.

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"

Package Details

Repository
Azure Classic pulumi/pulumi-azure
License
Apache-2.0
Notes

This Pulumi package is based on the azurerm Terraform Provider.