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

fix: Skip retrieving EKS cluster data when not creating the role #436

Conversation

wonko
Copy link
Contributor

@wonko wonko commented Nov 15, 2023

Description

Adds an additional conditional in the existing for_each for reading the EKS cluster data and constructing part of the policy document.

(I suppose the whole policy document can be skipped if there's no role being created... but no harm done in keeping it in, didn't want to break other things.)

Motivation and Context

Fixes #324

Breaking Changes

No breaking changes afaik, only adds hardening in the need for the execution of certain resources.

How Has This Been Tested?

Tested with the following code (module is local fork, at the v5.5.1 tag).

module "cluster_autoscaler_role" {
  create_role = false
  source      = "./modules/terraform-aws-iam/modules/iam-eks-role"
  #  version     = "5.5.1" 

  role_name = "cluster-autoscaler-false"

  cluster_service_accounts = {
    "foo" = ["kube-system:cluster-autoscaler"]
  }

  #   role_policy_arns = {
  #     cluster-autoscaler = module.cluster_autoscaler_policy.arn
  #   }
}

Also toggled the create_role to true to validate that the old flow still functions.

  • I have executed pre-commit run -a on my pull request
➜ pre-commit run -a
Terraform fmt............................................................Passed
Terraform wrapper with for_each in module................................Passed
Terraform validate.......................................................Passed
Terraform docs...........................................................Passed
Terraform validate with tflint...........................................Passed
check for merge conflicts................................................Passed
fix end of files.........................................................Passed

@wonko wonko changed the title Add additional conditional to the data elements fix: Don't read EKS cluster data and related resources when not creating the role Nov 15, 2023
Copy link

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 Dec 16, 2023
@wonko
Copy link
Contributor Author

wonko commented Dec 18, 2023

not stale ...

@github-actions github-actions bot removed the stale label Dec 19, 2023
Copy link
Contributor

@max-rocket-internet max-rocket-internet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@bryantbiggs bryantbiggs changed the title fix: Don't read EKS cluster data and related resources when not creating the role fix: Skip retrieving EKS cluster data when not creating the role Jan 18, 2024
@bryantbiggs bryantbiggs merged commit bcdf554 into terraform-aws-modules:master Jan 18, 2024
36 checks passed
antonbabenko pushed a commit that referenced this pull request Jan 18, 2024
### [5.33.1](v5.33.0...v5.33.1) (2024-01-18)

### Bug Fixes

* Skip retrieving EKS cluster data when not creating the role ([#436](#436)) ([bcdf554](bcdf554))
@antonbabenko
Copy link
Member

This PR is included in version 5.33.1 🎉

Copy link

I'm going to lock this pull request 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 related to this change, 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 Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iam-eks-role submodule create_role = false conflicts with data aws_eks_cluster resource
4 participants