Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Can't count lists in local vars if they contain non-created resources #16712

Closed
Labels
Milestone
@awilkins

Description

@awilkins

This works fine

$ terraform console > length(list("", "1", "")3

But 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp