Image for post
Image for post
Photo by James Coleman on Unsplash

So let’s say you have decomposed your Terraform infrastructure into small individual and mostly independent stacks. What is the best method to share common data between them? In this article we will discuss a way.

For this demonstration we will assume there are two services in separate stacks; service-a and service-b. Both require an ALB on same the subnets in the same VPC.

module service_a_alb {
source = "terraform-aws-modules/alb/aws"

name = "service-a"

load_balancer_type = "application"

vpc_id = "vpc-12345"
subnets = [
"subnet-foo",
"subnet-bar",
"subnet-baz"
]
...
}
module service_b_alb {
source = "terraform-aws-modules/alb/aws"

name = "service-b"

load_balancer_type = "application"

vpc_id =…

About

Derrick Petzold

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store