Skip to content

Commit 526d22f

Browse files
committed
Add additional resources as-per README instructions
1 parent bf97eec commit 526d22f

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# aws_resource_invalid_tags
2+
3+
Require tags to be assigned to a specific set of values.
4+
5+
## Example
6+
7+
```hcl
8+
rule "aws_resource_invalid_tags" {
9+
enabled = true
10+
tags = {
11+
Department = ["finance", "hr", "payments", "engineering"]
12+
Environment = ["sandbox", "staging", "production"]
13+
}
14+
exclude = ["aws_autoscaling_group"]
15+
}
16+
17+
provider "aws" {
18+
...
19+
default_tags {
20+
tags = { Environment = "sandbox" }
21+
}
22+
}
23+
24+
resource "aws_s3_bucket" "bucket" {
25+
...
26+
tags = { Project: "homepage", Department = "science" }
27+
}
28+
```
29+
30+
```
31+
$ tflint
32+
1 issue(s) found:
33+
34+
Notice: aws_s3_bucket.bucket Received 'science' for tag 'Department', expected one of 'finance,hr,payments,engineering'.
35+
36+
on test.tf line 3:
37+
3: tags = { Project: "homepage", Department = "science" }
38+
```
39+
40+
## Why
41+
42+
Enforce standard tag values across all resources.
43+
44+
## How To Fix
45+
46+
Align the provider, resource or autoscaling group tags to the configured expectation.

rules/provider.go

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ var manualRules = []tflint.Rule{
3939
NewAwsElasticBeanstalkEnvironmentInvalidNameFormatRule(),
4040
NewAwsSecurityGroupInvalidProtocolRule(),
4141
NewAwsSecurityGroupRuleInvalidProtocolRule(),
42+
NewAwsResourceInvalidTagsRule(),
4243
}
4344

4445
// Rules is a list of all rules

0 commit comments

Comments
 (0)