DefaultSubnet

Provides a resource to manage a default AWS VPC subnet in the current region.

The aws.ec2.DefaultSubnet behaves differently from normal resources, in that this provider does not create this resource but instead “adopts” it into management.

The aws.ec2.DefaultSubnet resource allows you to manage a region’s default VPC subnet but this provider cannot destroy it. Removing this resource from your configuration will remove it from your statefile and the provider management.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var defaultAz1 = new Aws.Ec2.DefaultSubnet("defaultAz1", new Aws.Ec2.DefaultSubnetArgs
        {
            AvailabilityZone = "us-west-2a",
            Tags = 
            {
                { "Name", "Default subnet for us-west-2a" },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v4/go/aws/ec2"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec2.NewDefaultSubnet(ctx, "defaultAz1", &ec2.DefaultSubnetArgs{
			AvailabilityZone: pulumi.String("us-west-2a"),
			Tags: pulumi.StringMap{
				"Name": pulumi.String("Default subnet for us-west-2a"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_aws as aws

default_az1 = aws.ec2.DefaultSubnet("defaultAz1",
    availability_zone="us-west-2a",
    tags={
        "Name": "Default subnet for us-west-2a",
    })
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const defaultAz1 = new aws.ec2.DefaultSubnet("default_az1", {
    availabilityZone: "us-west-2a",
    tags: {
        Name: "Default subnet for us-west-2a",
    },
});

Create a DefaultSubnet Resource

new DefaultSubnet(name: string, args: DefaultSubnetArgs, opts?: CustomResourceOptions);
@overload
def DefaultSubnet(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  availability_zone: Optional[str] = None,
                  customer_owned_ipv4_pool: Optional[str] = None,
                  map_customer_owned_ip_on_launch: Optional[bool] = None,
                  map_public_ip_on_launch: Optional[bool] = None,
                  outpost_arn: Optional[str] = None,
                  tags: Optional[Mapping[str, str]] = None,
                  tags_all: Optional[Mapping[str, str]] = None)
@overload
def DefaultSubnet(resource_name: str,
                  args: DefaultSubnetArgs,
                  opts: Optional[ResourceOptions] = None)
func NewDefaultSubnet(ctx *Context, name string, args DefaultSubnetArgs, opts ...ResourceOption) (*DefaultSubnet, error)
public DefaultSubnet(string name, DefaultSubnetArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args DefaultSubnetArgs
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 DefaultSubnetArgs
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 DefaultSubnetArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DefaultSubnetArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

DefaultSubnet Resource Properties

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

Inputs

The DefaultSubnet resource accepts the following input properties:

AvailabilityZone string
AZ for the subnet.
CustomerOwnedIpv4Pool string
MapCustomerOwnedIpOnLaunch bool
MapPublicIpOnLaunch bool
Whether instances launched into the subnet should be assigned a public IP address.
OutpostArn string
Tags Dictionary<string, string>
Map of tags to assign to the resource.
TagsAll Dictionary<string, string>
AvailabilityZone string
AZ for the subnet.
CustomerOwnedIpv4Pool string
MapCustomerOwnedIpOnLaunch bool
MapPublicIpOnLaunch bool
Whether instances launched into the subnet should be assigned a public IP address.
OutpostArn string
Tags map[string]string
Map of tags to assign to the resource.
TagsAll map[string]string
availabilityZone string
AZ for the subnet.
customerOwnedIpv4Pool string
mapCustomerOwnedIpOnLaunch boolean
mapPublicIpOnLaunch boolean
Whether instances launched into the subnet should be assigned a public IP address.
outpostArn string
tags {[key: string]: string}
Map of tags to assign to the resource.
tagsAll {[key: string]: string}
availability_zone str
AZ for the subnet.
customer_owned_ipv4_pool str
map_customer_owned_ip_on_launch bool
map_public_ip_on_launch bool
Whether instances launched into the subnet should be assigned a public IP address.
outpost_arn str
tags Mapping[str, str]
Map of tags to assign to the resource.
tags_all Mapping[str, str]

Outputs

All input properties are implicitly available as output properties. Additionally, the DefaultSubnet resource produces the following output properties:

Arn string
ARN for the subnet.
AssignIpv6AddressOnCreation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
AvailabilityZoneId string
CidrBlock string
CIDR block for the subnet.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlock string
IPv6 CIDR block.
Ipv6CidrBlockAssociationId string
OwnerId string
ID of the AWS account that owns the subnet.
VpcId string
VPC ID.
Arn string
ARN for the subnet.
AssignIpv6AddressOnCreation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
AvailabilityZoneId string
CidrBlock string
CIDR block for the subnet.
Id string
The provider-assigned unique ID for this managed resource.
Ipv6CidrBlock string
IPv6 CIDR block.
Ipv6CidrBlockAssociationId string
OwnerId string
ID of the AWS account that owns the subnet.
VpcId string
VPC ID.
arn string
ARN for the subnet.
assignIpv6AddressOnCreation boolean

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
availabilityZoneId string
cidrBlock string
CIDR block for the subnet.
id string
The provider-assigned unique ID for this managed resource.
ipv6CidrBlock string
IPv6 CIDR block.
ipv6CidrBlockAssociationId string
ownerId string
ID of the AWS account that owns the subnet.
vpcId string
VPC ID.
arn str
ARN for the subnet.
assign_ipv6_address_on_creation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
availability_zone_id str
cidr_block str
CIDR block for the subnet.
id str
The provider-assigned unique ID for this managed resource.
ipv6_cidr_block str
IPv6 CIDR block.
ipv6_cidr_block_association_id str
owner_id str
ID of the AWS account that owns the subnet.
vpc_id str
VPC ID.

Look up an Existing DefaultSubnet Resource

Get an existing DefaultSubnet 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?: DefaultSubnetState, opts?: CustomResourceOptions): DefaultSubnet
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        arn: Optional[str] = None,
        assign_ipv6_address_on_creation: Optional[bool] = None,
        availability_zone: Optional[str] = None,
        availability_zone_id: Optional[str] = None,
        cidr_block: Optional[str] = None,
        customer_owned_ipv4_pool: Optional[str] = None,
        ipv6_cidr_block: Optional[str] = None,
        ipv6_cidr_block_association_id: Optional[str] = None,
        map_customer_owned_ip_on_launch: Optional[bool] = None,
        map_public_ip_on_launch: Optional[bool] = None,
        outpost_arn: Optional[str] = None,
        owner_id: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None,
        vpc_id: Optional[str] = None) -> DefaultSubnet
func GetDefaultSubnet(ctx *Context, name string, id IDInput, state *DefaultSubnetState, opts ...ResourceOption) (*DefaultSubnet, error)
public static DefaultSubnet Get(string name, Input<string> id, DefaultSubnetState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Arn string
ARN for the subnet.
AssignIpv6AddressOnCreation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
AvailabilityZone string
AZ for the subnet.
AvailabilityZoneId string
CidrBlock string
CIDR block for the subnet.
CustomerOwnedIpv4Pool string
Ipv6CidrBlock string
IPv6 CIDR block.
Ipv6CidrBlockAssociationId string
MapCustomerOwnedIpOnLaunch bool
MapPublicIpOnLaunch bool
Whether instances launched into the subnet should be assigned a public IP address.
OutpostArn string
OwnerId string
ID of the AWS account that owns the subnet.
Tags Dictionary<string, string>
Map of tags to assign to the resource.
TagsAll Dictionary<string, string>
VpcId string
VPC ID.
Arn string
ARN for the subnet.
AssignIpv6AddressOnCreation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
AvailabilityZone string
AZ for the subnet.
AvailabilityZoneId string
CidrBlock string
CIDR block for the subnet.
CustomerOwnedIpv4Pool string
Ipv6CidrBlock string
IPv6 CIDR block.
Ipv6CidrBlockAssociationId string
MapCustomerOwnedIpOnLaunch bool
MapPublicIpOnLaunch bool
Whether instances launched into the subnet should be assigned a public IP address.
OutpostArn string
OwnerId string
ID of the AWS account that owns the subnet.
Tags map[string]string
Map of tags to assign to the resource.
TagsAll map[string]string
VpcId string
VPC ID.
arn string
ARN for the subnet.
assignIpv6AddressOnCreation boolean

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
availabilityZone string
AZ for the subnet.
availabilityZoneId string
cidrBlock string
CIDR block for the subnet.
customerOwnedIpv4Pool string
ipv6CidrBlock string
IPv6 CIDR block.
ipv6CidrBlockAssociationId string
mapCustomerOwnedIpOnLaunch boolean
mapPublicIpOnLaunch boolean
Whether instances launched into the subnet should be assigned a public IP address.
outpostArn string
ownerId string
ID of the AWS account that owns the subnet.
tags {[key: string]: string}
Map of tags to assign to the resource.
tagsAll {[key: string]: string}
vpcId string
VPC ID.
arn str
ARN for the subnet.
assign_ipv6_address_on_creation bool

Whether IPv6 addresses are assigned on creation.

  • availability_zone_id- AZ ID of the subnet.
availability_zone str
AZ for the subnet.
availability_zone_id str
cidr_block str
CIDR block for the subnet.
customer_owned_ipv4_pool str
ipv6_cidr_block str
IPv6 CIDR block.
ipv6_cidr_block_association_id str
map_customer_owned_ip_on_launch bool
map_public_ip_on_launch bool
Whether instances launched into the subnet should be assigned a public IP address.
outpost_arn str
owner_id str
ID of the AWS account that owns the subnet.
tags Mapping[str, str]
Map of tags to assign to the resource.
tags_all Mapping[str, str]
vpc_id str
VPC ID.

Import

Subnets can be imported using the subnet id, e.g.

 $ pulumi import aws:ec2/defaultSubnet:DefaultSubnet public_subnet subnet-9d4a7b6c

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.