Skip to content

fix: Eliminates depends_on in policy association using ref to access entry - #3640

Open
lorengordon wants to merge 1 commit into
terraform-aws-modules:masterfrom
lorengordon:fix/policy-association-reference
Open

fix: Eliminates depends_on in policy association using ref to access entry#3640
lorengordon wants to merge 1 commit into
terraform-aws-modules:masterfrom
lorengordon:fix/policy-association-reference

Conversation

@lorengordon

@lorengordon lorengordon commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

Description

By using a reference to the eks_access_entry resource, we can eliminate the depends_on in the aws_access_entry_policy_association resource.

Motivation and Context

Using depends_on is generally frowned on, and can cause odd errors for some terraform operations, especially resource recreating operations. In our case, we were running into problems when refactoring resulted in recreating access entries and policy associations for the same principal. Using a attribute ref helped terraform create the graph properly for more types of operations.

Breaking Changes

None.

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

@lorengordon

Copy link
Copy Markdown
Contributor Author
terraform-aws-eks/examples/eks-auto-mode > terraform apply -auto-approve
...
module.eks.aws_eks_access_entry.this["cluster_creator"]: Creating...
module.eks.aws_eks_access_entry.this["cluster_creator"]: Creation complete after 0s
module.eks.aws_eks_access_policy_association.this["cluster_creator_admin"]: Creating...
module.eks.aws_eks_access_policy_association.this["cluster_creator_admin"]: Creation complete after 1s
...
module.eks_auto_custom_node_pools.aws_eks_access_entry.this["cluster_creator"]: Creating...
module.eks_auto_custom_node_pools.aws_eks_access_entry.this["cluster_creator"]: Creation complete after 0s
module.eks_auto_custom_node_pools.aws_eks_access_policy_association.this["cluster_creator_admin"]: Creating...
module.eks_auto_custom_node_pools.aws_eks_access_policy_association.this["cluster_creator_admin"]: Creation complete after 1s
...
Apply complete! Resources: 106 added, 0 changed, 0 destroyed.

@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale label Mar 14, 2026
@lorengordon

Copy link
Copy Markdown
Contributor Author

Not stale

@bryantbiggs

Copy link
Copy Markdown
Member

we are unlikely to accept the change as is - its written correctly and this would technically be a breaking change. what issue are you encountering?

@lorengordon

Copy link
Copy Markdown
Contributor Author

There is no breaking change here that I can tell. What are you seeing when you run it that makes it breaking?

@bryantbiggs

Copy link
Copy Markdown
Member

it assumes principal_arn is always created by this module and never user provided

@lorengordon

lorengordon commented Mar 14, 2026

Copy link
Copy Markdown
Contributor Author

Hmm, are you sure? When I traced through the inputs, looking for principal_arn references before submitting, I checked for that. I am pretty sure the principal_arn is always user provided, except for the cluster_creator entry. But even the cluster_creator entry is still a principal that already exists, since it is the principal executing terraform.

Edit: Yeah, other than cluster_creator, all access entry objects are defined via the var.access_entries input,

var.access_entries,

@github-actions github-actions Bot removed the stale label Mar 15, 2026
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch 3 times, most recently from 5f95549 to bc51917 Compare April 6, 2026 22:27
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from bc51917 to d5f7386 Compare April 13, 2026 15:49
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from d5f7386 to 5bde289 Compare April 27, 2026 18:02
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch 3 times, most recently from fc1d714 to 9e4d21a Compare May 6, 2026 22:02
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from 9e4d21a to ee34a3c Compare May 29, 2026 17:06
@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale label Jun 29, 2026
@lorengordon

Copy link
Copy Markdown
Contributor Author

Not stale

@github-actions github-actions Bot removed the stale label Jun 30, 2026
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from ee34a3c to e7ffa9f Compare June 30, 2026 17:41
@github-actions

Copy link
Copy Markdown

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

@github-actions github-actions Bot added the stale label Jul 31, 2026
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from e7ffa9f to f7bb877 Compare July 31, 2026 16:37
@github-actions github-actions Bot removed the stale label Aug 1, 2026
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from f7bb877 to ae9d4d2 Compare August 6, 2026 16:05
@lorengordon
lorengordon force-pushed the fix/policy-association-reference branch from ae9d4d2 to eb9c3c6 Compare August 17, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants