Last active
September 16, 2015 18:42
-
-
Save thegedge/dcacba817bfb405afc59 to your computer and use it in GitHub Desktop.
Terraform stack layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Directory layout | |
stacks/ | |
|__ us-east-1 | |
|__ test | |
|__ vpc | |
|__ services | |
|__ apps | |
|__ foo | |
|__ bar | |
We have REMOTE files in every directory that's a stack, and a Makefile that finds directories | |
with a REMOTE file to initialize their remote state appropriately. | |
// If a module needs a VPC output | |
resource "terraform_remote_state" "vpc" { | |
backend = "s3" | |
config { | |
bucket = "terraform" | |
// these vars propagate from the stack to every module | |
key = "${var.region}/${var.environment}/vpc" | |
} | |
} | |
// If a module needs to know about the NAT or jump hosts | |
resource "terraform_remote_state" "services" { | |
backend = "s3" | |
config { | |
bucket = "terraform" | |
// these vars propagate from the stack to every module | |
key = "${var.region}/${var.environment}/services" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment