- Notifications
You must be signed in to change notification settings - Fork10.1k
Closed
Description
This works fine
$ terraform console > length(list("", "1", "")3But if you do
locals { list_of_things = [ "${a_resource.one.id}", "${a_resource.two.id}", "${a_resource.three.id}" ]}Then this will fail as it's unable to compute the count... unless the items inlist_of_things already exist, when it works. This means you can extend scripts that plan and run successfully but if you then destroy the resources and start from scratch they don't work.
resource "another_resource" "thing" { count = "${length(local.list_of_things)}"}Workaround : replace count with a literal count orlocal orvar variable with a literal value.