Is it possible to have a condition while using depends_on
Example:
resource something to_create
{
....
..
...
depends_on = [
local.check ? local.abc : local.xyz
]
}
Is it possible to have a condition while using depends_on
Example:
resource something to_create
{
....
..
...
depends_on = [
local.check ? local.abc : local.xyz
]
}
Copyright © 2021 Jogjafile Inc.
Relationships between resource in Terraform are static, which means that they are between the declarations written in your configuration and not between the dynamic data they evaluate to. There is no way to declare a dependency dynamically because Terraform must build the dependency graph before it evaluates any expressions; the dependency graph tells Terraform which order to evaluate the expressions in.
However, because the dependency relationships are static you typically don't need to decide them dynamically. Instead, you can just declare that the resource depends on both and then Terraform will wait until they are both complete before evaluating the resource: