The depends_on Meta-Argument
Version note: Module support for depends_on
was added in Terraform 0.13, and
previous versions can only use it with resources.
Use the depends_on
meta-argument to handle hidden resource or module dependencies that
Terraform can't automatically infer.
Explicitly specifying a dependency is only necessary when a resource or module relies on some other resource's behavior but doesn't access any of that resource's data in its arguments.
This argument is available in module
blocks and in all resource
blocks,
regardless of resource type. For example:
The depends_on
meta-argument, if present, must be a list of references
to other resources or child modules in the same calling module.
Arbitrary expressions are not allowed in the depends_on
argument value,
because its value must be known before Terraform knows resource relationships
and thus before it can safely evaluate expressions.
The depends_on
argument should be used only as a last resort. When using it,
always include a comment explaining why it is being used, to help future
maintainers understand the purpose of the additional dependency.