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]: Empty tags on aws_eks_pod_identity_association causes drift #37146

Closed
calvinbui opened this issue Apr 29, 2024 · 5 comments
Closed

[Bug]: Empty tags on aws_eks_pod_identity_association causes drift #37146

calvinbui opened this issue Apr 29, 2024 · 5 comments
Labels
bug Addresses a defect in current functionality. service/eks Issues and PRs that pertain to the eks service.

Comments

@calvinbui
Copy link

calvinbui commented Apr 29, 2024

Terraform Core Version

1.8.2

AWS Provider Version

5.47.0

Affected Resource(s)

  • aws_eks_pod_identity_association

Expected Behavior

No change in resource

No changes. Your infrastructure matches the configuration.

Actual Behavior

Change detected in with tags value.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

I am using the terraform-aws-modules/terraform-aws-eks-pod-identity module.

resource "aws_eks_pod_identity_association" "this" {
  for_each = { for k, v in var.associations : k => v if var.create }

  cluster_name    = try(each.value.cluster_name, var.association_defaults.cluster_name)
  namespace       = try(each.value.namespace, var.association_defaults.namespace)
  service_account = try(each.value.service_account, var.association_defaults.service_account)
  role_arn        = aws_iam_role.this[0].arn

  tags = merge(var.tags, try(each.value.tags, var.association_defaults.tags, {}))
}

Steps to Reproduce

  1. Create aws_eks_pod_identity_association with no empty tags (tags = {})
  + resource "aws_eks_pod_identity_association" "this" {
      + association_arn = (known after apply)
      + association_id  = (known after apply)
      + cluster_name    = "mycluster"
      + id              = (known after apply)
      + namespace       = "kube-system"
      + role_arn        = "arn:aws:iam::1234567890:role/aws-ebs-csi-driver-20240426012547740300000001"
      + service_account = "ebs-csi-controller-sa"
      + tags            = {}
      + tags_all        = {
          + "ortto.com/env"           = "xxx"
          + "ortto.com/owner"         = "xxx"
          + "ortto.com/project"       = "xxx"
          + "ortto.com/repo"          = "xxx"
          + "ortto.com/role"          = "xxx"
        }
    }
  1. Run another plan and see the resource has drifted with empty tags, even on subsequent applies.
  # module.pod_identity.aws_eks_pod_identity_association.this["xxx"] will be updated in-place
  ~ resource "aws_eks_pod_identity_association" "this" {
        id              = "a-xxx"
      + tags            = {}
        # (7 unchanged attributes hidden)
    }

However is tags is NOT empty, a tag is created, and the module does not detect a drift on the next run.

The tags_all tags from default_tags work and are present on the AWS resource.

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

Same issue faced in terraform-aws-modules/terraform-aws-eks-pod-identity#7 and referred here.

Would you like to implement a fix?

No

@calvinbui calvinbui added the bug Addresses a defect in current functionality. label Apr 29, 2024
Copy link

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 the service/eks Issues and PRs that pertain to the eks service. label Apr 29, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 29, 2024
@aristosvo
Copy link
Contributor

Hi @calvinbui!

I am not 100% sure this is an resource issue, it might be a configuration issue. Have you tried null instead of {} already?

@calvinbui
Copy link
Author

Hi @calvinbui!

I am not 100% sure this is an resource issue, it might be a configuration issue. Have you tried null instead of {} already?

yep that seems like the case.

  • {} --> drift
  • null --> no drift
  • removed the tag key --> no drift

i'll raise the issue back over in the module repo

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@terraform-aws-provider terraform-aws-provider bot removed the needs-triage Waiting for first response or review from a maintainer. label Apr 29, 2024
Copy link

github-actions bot commented Jun 1, 2024

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 Jun 1, 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. service/eks Issues and PRs that pertain to the eks service.
Projects
None yet
Development

No branches or pull requests

2 participants