I am looking to use the count
attribute on a resource
to handle some conditionals in terraform. I know that, if count = 0
in a resource
, it is null
in terraform. What I want to know if that null
will pass a depends_on
? E.g.
resource "a_resource" "foo" {
count = 0
...
}
resource "a_resource" "bar" {
depends_on = [a_resource.foo]
...
}
Would a_resource.bar
still be created?
The depends_on meta-argument instructs Terraform to complete all actions on the dependency object (including Read actions) before performing actions on the object declaring the dependency.
So as confirmed by the documentation, there is no functionality in the depends_on
meta-parameter that would impact actual management of a resource, but rather only the specific ordering of operations as Terraform DSL is declarative. a_resource.bar
would still be managed and applied.