You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fails with the following reason specifically when runningterraform importon an unrelated resource:
Error: Invalid for_each argument
│
│ on .terraform/modules/sso/main.tf line 96, in resource "aws_ssoadmin_account_assignment""this":
│ 96:for_each={ forassignmentinlocal.account_assignments:"${assignment.principal_name}.${assignment.permission_set.name}.${assignment.account_id}"=>assignment }
│ ├────────────────
│ │ local.account_assignments is tuple with 2 elements
│
│ 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.
Workaround
Comment out the module, run terraform import, then uncomment the module.
The text was updated successfully, but these errors were encountered:
Could someone apply a fix here? This also happens when you're trying to create a new iam-policy and add it to permissions set in the same TF apply run.
Problem
The following HCL snippet:
Fails with the following reason specifically when running
terraform import
on an unrelated resource:Workaround
Comment out the module, run
terraform import
, then uncomment the module.The text was updated successfully, but these errors were encountered: