1
votes

I just noticed that creating a basic VPC using Terraform also creates some "resources", like a DHCP Options Set, a Route Table, etc.

If you also define those resources in Terraform, new resources are added, but the "defaults" one (without tags) are never removed.

Is this a normal behaviour ? How to remove them or prevent their creation ?

I'm using Terraform 0.9.5

1

1 Answers

3
votes

The default resources associated with a VPC are created by AWS itself and Terraform cannot control their creation. Terraform can either create new resources and reconfigure the VPC to use them (thus leaving the defaults unused) or, in some cases, can "adopt" the default into Terraform management so it can be updated with Terraform.

Route tables are the resource type where this is most completely implemented. The aws_route_table_association resource allows a new, Terraform-managed route table to be connected to a VPC. Alternatively, the aws_default_route_table resource allows Terraform to take ownership of a VPC's default route table.

Terraform also provides a similar resource for managing a VPC's default network ACL.

At the time of writing, there is no such resource for for the default DHCP options, but terraform import is supported for aws_vpc_dhcp_options, which provides a different way to bring the default DHCP options under Terraform's control.