Ensures all S3 bucket names match the specified naming rules.
rule "aws_s3_bucket_name" {
enabled = true
regex = "^[a-z\\-]+$"
prefix = "my-org"
}
regex
: A Go regex that bucket names must match (string)prefix
: A prefix that should be used for bucket names (string)
resource "aws_s3_bucket" "foo" {
bucket = "foo"
}
$ tflint
1 issue(s) found:
Warning: Bucket name "foo" does not have prefix "my-org" (aws_s3_bucket_name)
on main.tf line 2:
2: bucket = "foo"
Amazon S3 bucket names must be globally unique and have restrictive naming rules.
- Prefixing bucket names with an organization name can help avoid naming conflicts
- You may wish to enforce other naming conventions (e.g., disallowing dots)
Ensure the bucket name matches the specified rules.