This repository contains Terraform configurations for creating and destroying an AWS Virtual Private Cloud (VPC).
Before using this Terraform configuration, ensure that you have the following prerequisites set up:
- AWS Account: You need an AWS account to create and manage resources.
- Terraform Installed: Ensure that Terraform is installed on your local machine. You can download it from Terraform's official website.
Create an S3 bucket in your AWS account named terraform-backend-s3-github
to be used as the backend for Terraform state. If this name is not available, create a new one.
Update the terraform_vpc/providers.tf
file with the correct bucket name.
backend "s3" {
bucket = "bucket_name"
key = "dev/terraform.tfstate"
region = "us-east-1"
}
-
Initialize Terraform:
Run the initialization command.
terraform init
-
Create VPC:
To create the VPC, follow the relevant Terraform command.
terraform apply --auto-approve
-
Destroy VPC:
To destroy the VPC and associated resources, follow the relevant Terraform command.
terraform destroy --auto-approve
After you have finished using the infrastructure, it's recommended to destroy it to avoid incurring unnecessary charges. Follow the "Destroy VPC" instructions mentioned above.