This repository contains a basic Terraform example that creates an Amazon Virtual Private Cloud (VPC) in AWS. This README provides instructions on how to use the example and what it does.
Before you begin, make sure you have the following prerequisites:
- Terraform installed on your local machine.
- AWS account credentials configured with the necessary permissions.
Follow these steps to use this Terraform example:
-
Clone this repository to your local machine:
git clone https://github.com/yourusername/basic-aws-vpc-terraform.git
-
Change into the project directory:
cd basic-aws-vpc-terraform
-
Create a
terraform.tfvars
file in the project directory to specify the required variables. You can use the following template as a starting point:# terraform.tfvars vpc_cidr_block = "10.0.0.0/16"
Replace
"10.0.0.0/16"
with your desired CIDR block for the VPC. -
Initialize the Terraform project:
terraform init
-
Review the Terraform execution plan to ensure you understand the changes that will be made:
terraform plan
-
Apply the Terraform configuration to create the AWS VPC:
terraform apply
Terraform will prompt you to confirm the changes. Type
yes
and press Enter to proceed. -
Wait for Terraform to provision the VPC and its resources. Once completed, you will see a message indicating success.
-
To destroy the created resources, run:
terraform destroy
This will remove the VPC and all associated resources.
This Terraform example creates an AWS VPC with the following characteristics:
- CIDR block: The CIDR block for the VPC is specified in the
terraform.tfvars
file. - DNS Support and Hostnames: DNS support and DNS hostnames are enabled for the VPC.
Ayoub Umoru