Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Terraform Module depends_on, Part Deux
# 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 should be at /kafka/main.tf
module "kafka_brokers" {
source = "../server-group/"
}
output "rolling_deployment_done" {
value = "${module.kafka_brokers.rolling_deployment_done}"
}
# 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 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}"
}
@josh-padnick

This comment has been minimized.

Copy link
Owner Author

commented Jun 3, 2018

Running terraform apply on this produces the desired behavior of the Kafka module finishing its execution before the Confluent module begins!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.