Is there a way to create default AWS VPC using terraform?
aws_vpc
resource doesn't have any attribute to mark VPC as default.
I know I can use aws-cli aws ec2 create-default-vpc
, but that's outside of the terraform.
No it looks like you can't via TF, you can adopt an existing default VPC but not create it: https://www.terraform.io/docs/providers/aws/r/default_vpc.html.
So use the AWS cli to recreate it (if you can) and then use this new provider to adopt it.
Error creating DB Instance: InvalidSubnet: No default subnet detected in VPC.
To my best knowledge default subnet can only be created in the default VPC. – NarūnasK