-
Notifications
You must be signed in to change notification settings - Fork 74
Add Resource Tags rule #639
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
base: master
Are you sure you want to change the base?
Changes from all commits
b0f573b
c130893
1632ca6
fd7235a
d169516
beff0bf
8078405
096536f
994f4d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,47 @@ | ||||||||||||
# aws_resource_tags | ||||||||||||
|
||||||||||||
Rule for resources tag presence and value validation from prefixed list. | ||||||||||||
|
||||||||||||
## Example | ||||||||||||
|
||||||||||||
```hcl | ||||||||||||
rule "aws_resource_tags" { | ||||||||||||
enabled = true | ||||||||||||
exclude = ["aws_autoscaling_group"] | ||||||||||||
required = ["Environment"] | ||||||||||||
values = { | ||||||||||||
Department = ["finance", "hr", "payments", "engineering"] | ||||||||||||
Environment = ["sandbox", "staging", "production"] | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
provider "aws" { | ||||||||||||
... | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Ensure that code samples are valid |
||||||||||||
default_tags { | ||||||||||||
tags = { Environment = "sandbox" } | ||||||||||||
} | ||||||||||||
} | ||||||||||||
|
||||||||||||
resource "aws_s3_bucket" "bucket" { | ||||||||||||
... | ||||||||||||
tags = { Project: "homepage", Department: "science" } | ||||||||||||
} | ||||||||||||
``` | ||||||||||||
|
||||||||||||
``` | ||||||||||||
$ tflint | ||||||||||||
1 issue(s) found: | ||||||||||||
|
||||||||||||
Notice: aws_s3_bucket.bucket Received 'science' for tag 'Department', expected one of 'finance,hr,payments,engineering'. | ||||||||||||
|
||||||||||||
on test.tf line 3: | ||||||||||||
3: tags = { Project: "homepage", Department = "science" } | ||||||||||||
``` | ||||||||||||
|
||||||||||||
## Why | ||||||||||||
|
||||||||||||
Enforce standard tag values across all resources. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Make sure Why tells the user why they should care about enforcing this and doesn't just restate the rule description. |
||||||||||||
|
||||||||||||
## How To Fix | ||||||||||||
|
||||||||||||
Align the provider, resource or autoscaling group tags to the configured expectation. | ||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Prefixed" connotes a string prefix whereas I'm pretty sure you just mean fixed/exact.