Terraform Series - Creating a VPC

In this post we will see how to create a private subnet using Terraform. I am going to create 3 files. 1) VPC Variables file. 2) VPC Module file. 3) VPC Output file. VPC variable holds all the variables like vpc name, cidr, subnet and az details which are passed as a variables. # Creating variable for VPC Name - testvpc variable "vpc_name" { description = "VPC Name" type = string default = "testvpc" } # VPC CIDR variable "vpc_cidr" { type = string default = "10.0.0.0/16" } # VPC Availability Zone variable "vpc_az" { type = list ( string ) default = [ "us-east-1a" , "us-east-1b" ] } # VPC Private Subnet variable "vpc_private_subnets" { type = list ( string ) default = [ "10.0.1.0/24" , "10.0.2.0/24" ] } Next file contains the core VPC module file which uses the variable file to create a VPC. # Create VPC Terraform Module module ...