I'm following the PluralSight course "Terraform - Getting Started" and in it they refer to this terraform file module_three.tf which states the following:
I have changed the original value us-east-1
to my selected region eu-west-2
...
variable "region" {
default = "eu-west-2"
}
...and...
#This uses the default VPC. It WILL NOT delete it on destroy.
resource "aws_default_vpc" "default" {
}
The commands terraform init
and terraform plan
execute as expected (and as described in the course), but terraform apply
produces this output:
aws_default_vpc.default: Creating...
Error: No default VPC found in this region.
How can I determine the default VPC in a given region and how can I specify a default VPC for my region?
Having to ask that question appears to go against the AWS documentation, as in their section Default VPC and default subnets they clearly state:
If you created your AWS account after 2013-12-04, it supports only EC2-VPC. In this case, you have a default VPC in each AWS Region. A default VPC is ready for you to use so that you don't have to create and configure your own VPC. You can immediately start launching Amazon EC2 instances into your default VPC. You can also use services such as Elastic Load Balancing, Amazon RDS, and Amazon EMR in your default VPC.
2013-12-04
, or at some point the default VPC in your account, in theeu-west-2
region, has been deleted. On that very page you linked to, if you just scroll down a bit, there are instructions for creating the default VPC if it does not already exist. – Mark B