Created
June 3, 2018 21:09
-
-
Save josh-padnick/0adb85088f7368f4a28db3bc0e6eb54a to your computer and use it in GitHub Desktop.
Terraform Module depends_on, Part Deux
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
# This file should be at /confluent/main.tf | |
variable "kafka_cluster_deployment_done" {} | |
module "confluent_tools" { | |
source = "../server-group/" | |
rolling_deployment_done = "${var.kafka_cluster_deployment_done}" | |
} |
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
# This file should be at /kafka/main.tf | |
module "kafka_brokers" { | |
source = "../server-group/" | |
} | |
output "rolling_deployment_done" { | |
value = "${module.kafka_brokers.rolling_deployment_done}" | |
} |
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
# This is our top-level example | |
module "kafka" { | |
source = "./kafka" | |
} | |
module "confluent" { | |
source = "./confluent" | |
kafka_cluster_deployment_done = "${module.kafka.rolling_deployment_done}" | |
} |
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
# This file should be at /server-group/main.tf | |
variable "rolling_deployment_done" { | |
default = "foo" | |
} | |
resource "null_resource" "rolling_deployment" { | |
triggers { | |
bar = "${var.rolling_deployment_done}" | |
} | |
provisioner "local-exec" { | |
command = "echo 'server-group.rolling_deployment sleeping for 3 seconds' && sleep 3" | |
} | |
} | |
output "rolling_deployment_done" { | |
value = "${null_resource.rolling_deployment.triggers.bar}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running
terraform apply
on this produces the desired behavior of the Kafka module finishing its execution before the Confluent module begins!