Skip to content

teng1/tf-aws-vpc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tf-aws-vpc

Mostly intended as a lighter version of the aws-vpc module by Anton Babenko and for learning. Testing some approaches using tf 0.13 hcl language. (see example dir)

Usage

Example of passing params down the usual way

# Configure the AWS Provider
provider "aws" {
  region  = "eu-west-2"
}

# Passing config down the usual way
module "vpc" {

  source = "../"
  name = "vpc-example"
  cidr_block = "10.10.0.0/16"
  public_subnets = ["10.10.1.0/24","10.10.2.0/24","10.10.3.0/24"]
  internet_gateway = true
  nat_gateway = true
  azs = ["eu-west-2a","eu-west-2b", "eu-west-2c"]
}

Looping modules with for_each and a map

module "envmap_vpc" {
  for_each = var.env_map

  source = "../"
  name = "envmap-example"
  cidr_block = each.value.cidr_block
  public_subnets = each.value.public_subnets
  internet_gateway = true
  azs = ["eu-west-2a","eu-west-2b", "eu-west-2c"]
}

Example of map used in tfvars, all config in a single data structure

env_map = {
        dev = {
            cidr_block = "10.10.0.0/16"
            public_subnets = ["10.10.1.0/24","10.10.2.0/24","10.10.3.0/24"]
        },
        uat = {
            cidr_block = "10.10.0.0/16"
            public_subnets = ["10.10.1.0/24","10.10.2.0/24","10.10.3.0/24"]
        },
        perf = {
            cidr_block = "10.10.0.0/16"
            public_subnets = ["10.10.1.0/24","10.10.2.0/24","10.10.3.0/24"]
        }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages