antonbabenko / terragrunt-reference-architecture

Terragrunt Reference Architecture (upd: May 2020)
MIT License
375 stars 104 forks source link

Does this actually work? #4

Closed sdot257 closed 4 years ago

sdot257 commented 4 years ago

I noticed the terragrunt.hcl file is missing. Not sure how to properly use this repo as a reference.

robcxyz commented 4 years ago

The terragrunt.hcl is for the newer versions of terragrunt when terraform switched to v0.12. For terraform versions <v0.11, terraform.tfvars was the convention. Other than that they are the same.

sdot257 commented 4 years ago

Yeah I finally figured that out BUT my next issue is that I don't think the variables are being passed into the module.

terraform {
  source = "github.com/terraform-aws-modules/terraform-aws-vpc.git"
}

include {
  path = find_in_parent_folders()
}

inputs = {
name = "prod"

# Visual subnet calculator - http://www.davidc.net/sites/default/subnets/subnets.html?network=10.10.0.0&mask=16&division=31.f4627231
cidr = "10.10.0.0/16"

azs = ["eu-central-1a", "eu-central-1b", "eu-central-1c"]

private_subnets = ["10.10.0.0/20", "10.10.16.0/20", "10.10.32.0/20"]

public_subnets = ["10.10.64.0/20", "10.10.80.0/20", "10.10.96.0/20"]

database_subnets = ["10.10.128.0/20", "10.10.144.0/20", "10.10.160.0/20"]

elasticache_subnets = ["10.10.176.0/20", "10.10.192.0/20", "10.10.208.0/20"]

create_database_subnet_group = false

create_elasticache_subnet_group = false

enable_nat_gateway = true

single_nat_gateway = true

enable_dns_hostnames = true

enable_dns_support = true

tags = {
  Environment = "prod"
}

}
Error: Reference to undeclared resource

  on vpc-endpoints.tf line 978, in resource "aws_vpc_endpoint" "efs":
 978:   subnet_ids          = coalescelist(var.efs_endpoint_subnet_ids, aws_subnet.private.*.id)

A managed resource "aws_subnet" "private" has not been declared in the root
module.

Error: Reference to undeclared resource

  on vpc-endpoints.tf line 1001, in resource "aws_vpc_endpoint" "cloud_directory":
1001:   subnet_ids          = coalescelist(var.cloud_directory_endpoint_subnet_ids, aws_subnet.private.*.id)

A managed resource "aws_subnet" "private" has not been declared in the root
module.

[terragrunt] 2020/01/15 06:25:04 Hit multiple errors:
exit status 1
antonbabenko commented 4 years ago

This repository is using the previous major version of Terragrunt which is compatible with Terraform 0.11.

I will update this repo, but in the meanwhile, you can take a look at modules.tf-demo repo which works with recent Terragrunt and Terraform 0.12.