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

[Bug]: sporadic errors in aws_eks_access_policy_association #35728

Closed
pdeva opened this issue Feb 9, 2024 · 5 comments · Fixed by #35736
Closed

[Bug]: sporadic errors in aws_eks_access_policy_association #35728

pdeva opened this issue Feb 9, 2024 · 5 comments · Fixed by #35736
Labels
bug Addresses a defect in current functionality. eventual-consistency Pertains to eventual consistency issues. service/eks Issues and PRs that pertain to the eks service.
Milestone

Comments

@pdeva
Copy link

pdeva commented Feb 9, 2024

Terraform Core Version

1.7.3

AWS Provider Version

5.36.0

Affected Resource(s)

  • aws_eks_access_policy_association

Expected Behavior

I am associating AWS SSO created IAM roles to eks access entries using code given below. if this code is going to fail due to principal_arn not being found, it should fail during the planning phase itself. it should never be the case that principal_arn is found during planning and i get an error of it not being found during application phase, especially if no other changes to aws is made during this time.

Actual Behavior

Here is a screenshot of this full terraform run. you can see all the policyArn this fails on was indeed inferred correctly in the data sources.

app terraform io_app_astradot_workspaces_staging_runs_run-cJFRJ8CsYzqVbYcL

on just re-running terraform, without making any changes, the errors go away and apply finishes. its unclear what causes the code to fail in the first place and why it suddenly works next time

app terraform io_app_astradot_workspaces_staging_runs_run-oWfT14Pchj4z5M8j

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

terraform {
  required_version = ">= 1.0"
  cloud {
    workspaces {
      name = "staging"
    }
  }

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 5.0"
    }
 
  }
}

Steps to Reproduce

data "aws_iam_roles" "roles" {
  name_regex  = "AWSReservedSSO_${var.sso_permset_name}_.*"
  path_prefix = "/aws-reserved/sso.amazonaws.com/"
}

locals {
  principal_arn = one(data.aws_iam_roles.roles.arns)
}

resource "aws_eks_access_entry" "this" {
  cluster_name      = var.eks_cluster_name
  principal_arn     = local.principal_arn
  kubernetes_groups = var.kubernetes_groups
}

resource "aws_eks_access_policy_association" "this" {
  count         = length(var.policy_arn) > 0 ? 1 : 0
  cluster_name  = var.eks_cluster_name
  principal_arn = local.principal_arn
  policy_arn    = var.policy_arn
  access_scope {
    type = "cluster"
  }
}

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

@pdeva pdeva added the bug Addresses a defect in current functionality. label Feb 9, 2024
Copy link

github-actions bot commented Feb 9, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/eks Issues and PRs that pertain to the eks service. service/iam Issues and PRs that pertain to the iam service. labels Feb 9, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 9, 2024
@ewbankkit ewbankkit added eventual-consistency Pertains to eventual consistency issues. and removed service/iam Issues and PRs that pertain to the iam service. needs-triage Waiting for first response or review from a maintainer. labels Feb 9, 2024
@ewbankkit
Copy link
Contributor

Relates #35535.

@pdeva
Copy link
Author

pdeva commented Feb 9, 2024

so in the runs mentioned above, the roles in question were not updated at all. thats why a data source is used for the role instead of a resource

@github-actions github-actions bot added this to the v5.37.0 milestone Feb 9, 2024
Copy link

This functionality has been released in v5.37.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. eventual-consistency Pertains to eventual consistency issues. service/eks Issues and PRs that pertain to the eks service.
Projects
None yet
2 participants