Hello,
I have tf config which uses the following modules:
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role-with-oidc"
version = "5.39.0"
source = "terraform-aws-modules/eks-pod-identity/aws"
version = "1.1.0"
and resource aws_eks_pod_identity_association
.
There are two environments - stg and perf envs.
The state of perf is bigger:
# stg
tf state list | wc -l
5380
# perf
tf state list | wc -l
7959
I changed tf config which leads to recreation of aws_eks_pod_identity_association
resources. In stg it worked well.
But in perf it stucks on:
...
module.iam_assumable_role["foo"].aws_iam_role_policy_attachment.custom[2]: Refreshing state... [id=xxx]
Always different role and attachment. Not the same. Seems to be randomly.
I’m not sure if it is due rate limiting or some other issue.
There is no any errors. Just stuck.
The tf plan
in perf env without changes updates state well showing Refreshing state...
and finishing with No changes. Your infrastructure matches the configuration.
. But when I’m trying to plan my new changes, it hangs.
I tried to run with TF_LOG=debug tf plan
which hangs on something like this for few minutes:
2024-12-06T02:18:02.104+0900 [DEBUG] ReferenceTransformer: "module.pod_identity[\"xxx\"].aws_iam_role_policy_attachment.this[\"arn:aws:iam::123:policy/my_policy\"]" references: [module.pod_identity.var.additional_policy_arns (expand) module.pod_identity.var.create (expand) module.pod_identity.aws_iam_role.this (expand)]
and then loops infinitely over DestroyEdgeTransformer2
log lines.
Also tried to run with TF_LOG=TRACE tf plan
which run for 10+ hours and looped on DestroyEdgeTransformer
and DestroyEdgeTransformer2
which seems to me as some internal state things.
If I do run tf plan -target=module.iam_assumable_role
on my changes, then it shows desired changes:
Plan: 3404 to add, 0 to change, 3404 to destroy.
What it might be? How to debug the issue?