In an enterprise, the creation of VPC and related resources, usually, is managed by a separate team. Sometimes it is part of the enterprise account vending process.
This is an example Terraform script, which creates the VPC resources required for this solution. This uses the well-known module terraform-aws-modules/vpc/aws to create the VPC resources.
- Terraform backend provider and state locking providers are identified and bootstrapped.
- A bootstrap module/example is provided that provisions Amazon S3 for Terraform state storage and Amazon DynamoDB for Terraform state locking.
- cd to
vpc
folder.
- Modify the
backend "S3"
section in provider.tf
with correct values for region
, bucket
, dynamodb_table
, and key
.
- Use provided values as guidance.
- Modify
terraform.tfvars
to your requirements.
- Use provided values as guidance.
- Make sure you are using the correct AWS Profile that has permission to provision the target resources.
aws sts get-caller-identity
- Execute
terraform init
to initialize Terraform.
- Execute
terraform plan
and verify the changes.
- Execute
terraform apply
and approve changes to provision the resources.
Name |
Source |
Version |
vpc |
terraform-aws-modules/vpc/aws |
3.14.2 |
Name |
Description |
Type |
Default |
Required |
env_name |
Environment name e.g. dev, prod |
string |
n/a |
yes |
project |
Project to be used on all the resources identification |
string |
n/a |
yes |
region |
The AWS Region e.g. us-east-1 for the environment |
string |
n/a |
yes |
tags |
Mandatory tags for the resources |
map(string) |
n/a |
yes |
vpc_private_subnet_tags |
Tags for the private subnet |
map(string) |
n/a |
yes |
vpc_public_subnet_tags |
Tags for the public subnet |
map(string) |
n/a |
yes |
vpc_tags |
Tags for the VPC |
map(string) |
n/a |
yes |
r53_zone_names |
Private Route53 Zone names to create and associate with the VPC |
list(string) |
[] |
no |