Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IAM Role issue #496

Closed
skuriyadi opened this issue May 2, 2022 · 16 comments
Closed

IAM Role issue #496

skuriyadi opened this issue May 2, 2022 · 16 comments
Labels
bug Something isn't working upstream issue
Milestone

Comments

@skuriyadi
Copy link

Hi,

I am getting below error when using latest version of your module, please advise.

Error: Invalid for_each argument

│ on .terraform/modules/eks-cluster.aws_eks/main.tf line 250, in resource "aws_iam_role_policy_attachment" "this":
│ 250: for_each = local.create_iam_role ? toset(compact(distinct(concat([
│ 251: "${local.policy_arn_prefix}/AmazonEKSClusterPolicy",
│ 252: "${local.policy_arn_prefix}/AmazonEKSVPCResourceController",
│ 253: ], var.iam_role_additional_policies)))) : toset([])
│ ├────────────────
│ │ local.create_iam_role is true
│ │ local.policy_arn_prefix is a string, known only after apply
│ │ var.iam_role_additional_policies is empty list of string

│ The "for_each" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. To work around this, use the -target argument to first apply only the resources that the for_each depends on.

@skuriyadi skuriyadi added the question Further information is requested label May 2, 2022
@askulkarni2
Copy link
Contributor

Hi @skuriyadi this error is documented here. As documented there, this is an issue in Terraform Core.

If you remove the depends_on in your module definition like suggested this error should go away. On the flip side, you may have to do multiple passes over your terraform apply and destroy.

@grid-dev
Copy link

grid-dev commented May 3, 2022

@askulkarni2 As this code is coming from the module, what are you usually doing to circumvent it here? As removing the dependency seems not really a solution.

@skuriyadi
Copy link
Author

@askulkarni2 , I will continue using the older version for now, I guess the solution which is provided will beat the purpose of creating a complete automated infra setup.
Thank you,
Shiva

@bryantbiggs
Copy link
Contributor

@skuriyadi can you share you current configuration?

@skuriyadi
Copy link
Author

Hi @bryantbiggs I am using your module to create a EKS cluster with managed nodegroup and your addon module.
Sorry, I wont be able to share the configuration.

Thank you!

@grid-dev
Copy link

grid-dev commented May 4, 2022

A bit unsatisfying, but thanks for your responses

@bryantbiggs
Copy link
Contributor

there has been some recent movement on this issue so hopefully improvements in Terraform core are coming soon hashicorp/terraform#30937

@skuriyadi
Copy link
Author

Hi Team,

Did any improvements come from Terraform on this issuue

@skuriyadi
Copy link
Author

HI @bryantbiggs ,
Please let me know if here any update on this?

@bryantbiggs
Copy link
Contributor

Hi @skuriyadi - you can track the progress in the linked issue above hashicorp/terraform#30937

@bryantbiggs bryantbiggs added upstream issue and removed question Further information is requested labels Jun 18, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added stale and removed stale labels Jul 19, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added stale and removed stale labels Aug 19, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Sep 19, 2022
@domeales-paloit
Copy link

I also had this issue. It turned up when I added a depends_on argument on the module resource using this module.

I worked out that if remove the depends_on and use an implicit dependency by using the outputs of the upstream resource in the tags of this module.

It worked for me. Bit of a hack, but I moved forward at least.

@github-actions github-actions bot removed the stale label Sep 21, 2022
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has been open 30 days
with no activity. Remove stale label or comment or this issue will be closed in 10 days

@github-actions github-actions bot added the stale label Oct 21, 2022
@bryantbiggs bryantbiggs added bug Something isn't working and removed stale labels Oct 25, 2022
@bryantbiggs bryantbiggs added this to the v5.0 milestone Oct 25, 2022
@bryantbiggs
Copy link
Contributor

Please see #1319

This has been resolved in v19 of the terraform-aws-eks module

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working upstream issue
Projects
None yet
Development

No branches or pull requests

5 participants