VPC Networking - Part 2

cd ~/environment/terraform/modules/tf-vpc

## Initialize Terraform
terraform init

## Format code, validate syntax & check security issues
terraform fmt
terraform validate

## Terraform "plan" what it is going to do
terraform plan -out tfplan

## Build the VPC
terraform apply tfplan

## Destroy what we have created !!!
# terraform destroy -auto-approve
โœ๏ธ VPC >> Elastic-IP & Subnets
๐Ÿš€ tf-eip.tf >> Allocating an Elastic IP address
๐Ÿš€ subnets.tf & how Terraform references other existing resources by name
terraform state list | grep vpc
terraform state show aws_vpc.tf-vpc

Now use the console to check all the resources exist:

  • โœ… A new VPC CI/CD-VPC
  • โœ… The new Elastic IP: CICD-EIP
  • The new Subnets: CICD-Public-Subnet & CICD-Private-Subnet