Skip to content

Latest commit

 

History

History

vpc

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Create VPC (optional)

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.

Prerequisites

  • 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.

Execution

  • 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.

Requirements

Name Version
terraform >= v1.1.9
aws >= 4.13.0

Providers

Name Version
aws 4.22.0

Modules

Name Source Version
vpc terraform-aws-modules/vpc/aws 3.14.2

Resources

Name Type
aws_route53_zone.pvt_zone resource

Inputs

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

Outputs

Name Description
r53_hosted_zones Route 53 hosted zones created
vpc_id VPC Id for the provisioned VPC
vpc_private_subnet_ids Subnet Id(s) for the provisioned public Subnets
vpc_public_subnet_ids Subnet Id(s) for the provisioned public Subnets