Skip to content

Conversation

daniel-cit
Copy link
Contributor

This PR adds a fix for the error

Error: Invalid for_each argument

│  156:   for_each = { for k, v in var.egress_policies_dry_run : k => v }
│     ├────────────────
│     │ var.egress_policies_dry_run is a list of object, known only after apply
│ 
│ The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that
│ will identify the instances of this resource.
│ 
│ When working with unknown values in for_each, it's better to define the map keys statically in your configuration and place apply-time results only in the map
│ values.
│ 
│ Alternatively, you could use the -target planning option to first apply only the resources that the for_each value depends on, and then apply a second time to fully
│ converge.

@daniel-cit daniel-cit requested review from a team and imrannayer as code owners July 18, 2025 20:53
@daniel-cit
Copy link
Contributor Author

@apeabody Could you PTAL

Copy link
Contributor

@apeabody apeabody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @daniel-cit!

Copy link
Contributor

@apeabody apeabody left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @daniel-cit!

@apeabody apeabody merged commit a40c3c0 into terraform-google-modules:main Jul 22, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants