Skip to content

Error for ephemeral resource in module with count = 0 #36714

@pmac72

Description

@pmac72

Terraform Version

Terraform v1.11.2
on darwin_arm64

Terraform Configuration Files

main.tf

module "count_1" {
  count  = 1
  source = "./module"
}

module "count_0" {
  count  = 0
  source = "./module"
}

./module/main.tf

ephemeral "random_password" "this" {
  length = 10
}

Debug Output

trace output

Expected Behavior

No error reported when the module count is 0.

Actual Behavior

│ Error: Graph node has invalid dynamic subgraph
│
│ The internal logic for "module.count_0.ephemeral.random_password.this (expand)" generated an invalid dynamic subgraph: no roots found.
│
│ This is a bug in Terraform. Please report it!

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

This is a simplified example to show the issue, the actual module where I came across this has variables that can cause the count to be >=0.

Also tested this with an ephemeral aws_ssm_parameter from the AWS Provider with the same result.

References

No response

Generative AI / LLM assisted development?

No response

Metadata

Metadata

Assignees

Labels

bugnewnew issue not yet triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions