code-dumps/terraform/aws-vpc
2020-07-31 16:36:05 +08:00
..
provider.tf NEW: vpc-subnet 2020-04-23 10:36:56 +08:00
README.md UPD: moved around variables 2020-04-23 12:10:57 +08:00
vpc-subnets.tf UPD: moved around variables 2020-04-23 12:10:57 +08:00

Terraform config for creating VPC and subnets

These config will create the following resources on AWS. The VPC CIDR is hard-coded as 10.0.0.0/16. The subnets will sit in different availablity zones for redundancy. Resources are all tagged from a globaltag list.

  • 1 VPC
  • public subnets in all AZs
  • private subnets in all AZs
  • 1 internet gateway
  • 1 nat gateway

Variables to TF

These are required variables, which can be set in terraform.tfvars

# general variables
resource_prefix = "unspecified"
globalTags {
	"Environment"      = "KFLAB"
    "TerraformiCliVersion" = "0.12.24"
    "TerraformMode" = "InitialDeploymentOnly"
    "Ticket" = "NotApplicable"
}

# aws provider variables
aws_access_key = "redacted"
aws_secret_key = "redacted"
aws_region = "ap-east-1"
resource_prefix = "kflab-dev"

Revision notes

  • Previously terraform plan would fail to compute the count for routing table association. This is now corrected by setting count = number of AZs