Create deployment dependencies¶
See also: Juju | Charm
Create a dependency¶
The Terraform Provider for Juju does not support waiting for a particular charm status before
creating other resources. However, you can use Terraform native
provisioner’s local-exec, Terraform’s null_resource, Juju
CLI’s wait-for command altogether to create a dependency in resource
creations.
This is particularly useful when the charm may not be holistic and requires a step-by-step approach
in deployment strategies.
To create a dependency, you can use the null_resource resource to run a command that waits for
the charm to be active before starting the integration.
resource "juju_application" "my_charm" {
name = ...
charm {
...
}
}
resource "null_resource" "wait_for_my_charm" {
provisioner "local-exec" {
command = "juju wait-for application ${juju_application.my_charm.name}"
}
}
resource "juju_integration" "my_integration" {
depends_on = [ null_resource.wait_for_my_charm ]
}
This way, the my_integration resource will only be created after the my_charm application is
active, ensuring that the charm is ready for integration.