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

New rule(s) request/proposal: enforce drift detecting Terraform resources over those that don't #533

Open
tomelliff opened this issue Aug 15, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@tomelliff
Copy link

The aws_security_group_rule, aws_route, aws_iam_role_policy_attachment can all lead to drift that Terraform is unable to correct because they don't allow for exclusively managing the containing resource (security group, route table, IAM role respectively).

This is probably not an exhaustive list of resources like this.

This can cause issues where changes can be introduced to these resources and Terraform is unaware of them and unable to correct them. As a general rule, I push colleagues to use the exclusive managing resources but it's a regular thing that comes up during code review. It would be helpful if we could lint on this instead (with the normal opt out via comments where appropriate).

Would you be open to a pull request (or potentially one per resource) that adds a non default enabled rule that forbids the use of eg aws_security_group_rule in favour of aws_security_group rule blocks?

@tomelliff tomelliff changed the title New rule(s) request/proposal: enforce drift drift detecting Terraform resources over those that don't New rule(s) request/proposal: enforce drift detecting Terraform resources over those that don't Aug 15, 2023
@wata727
Copy link
Member

wata727 commented Sep 9, 2023

Looks good. I think the suggested rules are useful.
If possible, it might be nice to have rules that can alert you when a conflict actually occurs.

@wata727 wata727 added the enhancement New feature or request label Sep 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants