While provisioning works after this refactor, I'm now getting a warning on which acts as an error during `terraform destroy` (`TF_WARN_OUTPUT_ERRORS=0`can silence this, but there must be a better approach).
module.masters.output.kubeadm_join_command: variable "kubeadm_join" is nil, but no error was reported
The output block emits the Kubernetes join command which is dependent on an external data block which is dependent on the instance module (master_instance) to have provisioned.
// module.masters includes a module.instance called "master_instance"
output "kubeadm_join_command" {
depends_on = ["module.master_instance", "data.external.kubeadm_join"]
value = "${data.external.kubeadm_join.result["command"]}"
}
I attempted tricks to make the value not "nil" in the block above: coalesce, concat, ternary, values, lookup. None of those helped.
There appear to be several Terraform issues open with similar concerns, but I don't see any direct or indirect workarounds offered.
I also attempted to modify the `program` referenced in the external data to emit an empty json block instead of erroring when the master instance is not available for the input variable: `{ "command": "" }` .. that didn't help either.
Any pointers?