aws_default_subnet

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

The aws_default_subnet behaves differently from normal resources, in that Terraform does not create this resource, but instead "adopts" it into management.

Example Usage

Basic usage with tags:

resource "aws_default_subnet" "default_az1" {
  availability_zone = "us-west-2a"

    tags {
        Name = "Default subnet for us-west-2a"
    }
}

Argument Reference

The arguments of an aws_default_subnet differ from aws_subnet resources. Namely, the availability_zone argument is required and the vpc_id, cidr_block, ipv6_cidr_block, and assign_ipv6_address_on_creation arguments are computed. The following arguments are still supported:

  • map_public_ip_on_launch - (Optional) Specify true to indicate that instances launched into the subnet should be assigned a public IP address.
  • tags - (Optional) A mapping of tags to assign to the resource.

Removing aws_default_subnet from your configuration

The aws_default_subnet resource allows you to manage a region's default VPC subnet, but Terraform cannot destroy it. Removing this resource from your configuration will remove it from your statefile and management, but will not destroy the subnet. You can resume managing the subnet via the AWS Console.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

© 2018 HashiCorp
Licensed under the MPL 2.0 License.
https://www.terraform.io/docs/providers/aws/r/default_subnet.html