Skip to content

Instantly share code, notes, and snippets.

@jritsema
Last active August 12, 2022 21:11
Show Gist options
  • Save jritsema/5e73be8a86b347a67a2f2e6a84d332ec to your computer and use it in GitHub Desktop.
Save jritsema/5e73be8a86b347a67a2f2e6a84d332ec to your computer and use it in GitHub Desktop.
Using a Terraform Module Both Inside and Outside of Proton
resource "aws_alb" "main" {
name = local.name
internal = local.internal
subnets = split(",", local.internal == true ? local.private_subnets : local.public_subnets)
}
locals {
# inside of proton
# (from proton.service_instance.variables.tf at runtime)
name = var.service_instance.inputs.name
vpc = var.service_instance.inputs.vpc
private_subnets = var.service_instance.inputs.private_subnets
public_subnets = var.service_instance.inputs.public_subnets
internal = var.service_instance.inputs.internal
}
locals {
# outside of Proton
# (from variables.tf)
name = var.name
vpc = var.vpc
private_subnets = var.private_subnets
public_subnets = var.public_subnets
internal = var.internal
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment