Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create default VPC and subnet for 02-overview #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tzujui
Copy link

@tzujui tzujui commented Aug 23, 2024

Description

  • Create default VPC and subnet using terraform resources
  • upgraded aws provider to version 4 to use force_destroy on both resources (see known issues from aws provider below)

Related Issue

Addressed VPCIdNotSpecified error mentioned in #7

How Has This Been Tested?

  • Run terraform init and verify that hashicorp/aws v4.x.x is used.
  • Run terraform plan and apply.
  • Verify that resources are created in AWS console.
  • Manually detached and delete default internet gateway and delete subnets. Then, run terraform destroy.
  • Verify that resources are destroyed in AWS console. Destroy complete! Resources: 3 destroyed.

Screenshots:

Screenshot 2024-08-23 at 12 15 51 PM
Screenshot 2024-08-23 at 12 13 42 PM

Known issues from terraform-provider-aws

I ran into an issue when destroying the default VPC. The error message is The vpc 'vpc-xxxxxxxxxxxxxx' has dependencies and cannot be deleted. Other resources are implicit created with the aws_deafult_vpc resources so based on AWS's doc, I detached and deleted the default internet gateway and deleted subnet manually in console. Then, run terraform destroy to tear down the default VPC. (I had to run it twice cause the terraform-provider-aws_v4.67.0_x5 plugin crashed due to resource change request being cancelled.) This is the workaround that worked for me.
If you are interested in learning about the root cause, I also found this draft PR and looks like they are working on fixing the default VPC bug caused by IGW. Hope this helps!

Addressed VPCIdNotSpecified error mentioned in sidpalas#7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant