Skip to content

Commit

Permalink
Global variables through output value bubbling
Browse files Browse the repository at this point in the history
I should fill out some type of issue on the Terraform repository. Values shouldn't need to be bubbled up to the root module like this so they can be accessed elsewhere, right?
  • Loading branch information
Starz0r committed Sep 12, 2019
1 parent 660541f commit 925bf05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions databases/imports.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ module "pg" {

pg_keycloak_pass = "${var.db_pg_keycloak_pass}"
}

output "pg_addr" {
value = "${module.pg.addr}"
}
4 changes: 4 additions & 0 deletions databases/pg/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ provider "postgresql" {
expected_version = "11.0.0"
}

output "addr" {
value = "${digitalocean_database_cluster.pg_master.host}"
}

variable "pg_keycloak_pass" {}
module "keycloak" {
source = "./keycloak"
Expand Down
3 changes: 3 additions & 0 deletions globals.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
locals {
PG_MASTER_ADDR = "${module.database_resources.pg_addr}"
}

0 comments on commit 925bf05

Please sign in to comment.