Skip to content

Instantly share code, notes, and snippets.

@jonathanhle
Forked from antonbabenko/README.md
Created February 15, 2019 01:36
Show Gist options
  • Save jonathanhle/c6ad93982eeae37e2b84068b33d8cf8a to your computer and use it in GitHub Desktop.
Save jonathanhle/c6ad93982eeae37e2b84068b33d8cf8a to your computer and use it in GitHub Desktop.
Example of using terraform-aws-modules/vpc/aws module with Terragrunt

This is an example of how to use Terraform AWS registry modules with Terragrunt.

Notes:

  1. source has to be full git URL and not Terraform Registry open issue #311
  2. File main_providers.tf is named so, because it will be copied to another local directory and merged with module's code. If such file exists in the module already then it will overwrite the one provided by the module.
provider "aws" {
region = "eu-west-1"
}
terraform {
backend "s3" {}
}
terragrunt = {
terraform {
source = "git::[email protected]:terraform-aws-modules/terraform-aws-vpc.git?ref=v1.0.4"
}
}
# MODULE PARAMETERS
name = "my-vpc"
cidr = "10.212.0.0/20"
azs = ["eu-west-1a", "eu-west-1b", "eu-west-1c"]
private_subnets = ["10.212.1.0/24", "10.212.2.0/24", "10.212.3.0/24"]
public_subnets = ["10.212.11.0/24", "10.212.12.0/24", "10.212.13.0/24"]
database_subnets = ["10.212.5.0/24", "10.212.6.0/24", "10.212.7.0/24"]
create_database_subnet_group = true
enable_dns_support = true
enable_dns_hostnames = true
enable_nat_gateway = true
single_nat_gateway = false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment