Skip to content

Commit

Permalink
Add additional resources as-per README instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
marckysharky committed May 7, 2024
1 parent bf97eec commit 526d22f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
46 changes: 46 additions & 0 deletions docs/rules/aws_resource_invalid_tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# aws_resource_invalid_tags

Require tags to be assigned to a specific set of values.

## Example

```hcl
rule "aws_resource_invalid_tags" {
enabled = true
tags = {
Department = ["finance", "hr", "payments", "engineering"]
Environment = ["sandbox", "staging", "production"]
}
exclude = ["aws_autoscaling_group"]
}
provider "aws" {
...
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.

## How To Fix

Align the provider, resource or autoscaling group tags to the configured expectation.
1 change: 1 addition & 0 deletions rules/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var manualRules = []tflint.Rule{
NewAwsElasticBeanstalkEnvironmentInvalidNameFormatRule(),
NewAwsSecurityGroupInvalidProtocolRule(),
NewAwsSecurityGroupRuleInvalidProtocolRule(),
NewAwsResourceInvalidTagsRule(),
}

// Rules is a list of all rules
Expand Down

0 comments on commit 526d22f

Please sign in to comment.