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

Detect terraform drift and avoid unwanted additions #3446

Open
GuptaNavdeep1983 opened this issue Aug 22, 2023 · 1 comment
Open

Detect terraform drift and avoid unwanted additions #3446

GuptaNavdeep1983 opened this issue Aug 22, 2023 · 1 comment
Labels
question Further information is requested stale:exempt

Comments

@GuptaNavdeep1983
Copy link
Contributor

GuptaNavdeep1983 commented Aug 22, 2023

Description

The runner module is designed with open for extension in mind, instead of requiring users inject all needs. Example of this approach is the module is creating roles and attaching the minimal required policies. Roles are output (exported) and users can add more policies based on the need. The drawback is that the role is managed and the policies that terraform attaches. But no other policies attached to the same role.

Risk

When adding policies manually to a role (for what reason) the drift will only been seen once by terraform when running a refresh state without auto apply. Next the policy becomes part of the state. Effect is that policies can be attached that have too many permissions and won't be detected since the drift is hidden. When you rebuild your environment the drift is gone, but for environments your continuous update the drift remains.

Detection / Solution

We are looking for solution to prevent this drift. One could be refactoring the module and don't allow the open for extension principle. This option we don't like. But so far, we have not found effective ways to protect.

Any suggestions from the community?

@GuptaNavdeep1983 GuptaNavdeep1983 changed the title Restore terraform roles to original and avoid unwanted additions Detect terraform drift and avoid unwanted additions Aug 22, 2023
@npalm npalm added question Further information is requested stale:exempt labels Aug 23, 2023
@maartenvanderhoef
Copy link

  1. Attaching a iam policy (not inline) to a role is not causing drift which will be undone when running the philips runner module again.
  2. When you use OIDC with your GH Workflows ( https://igorzhivilo.com/github-actions/github-actions-openid-aws/ ) the instance profile's permissions are practically irrelevant, unless you need to mount efs on boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale:exempt
Projects
None yet
Development

No branches or pull requests

3 participants