tflint-naming-convention
is a tflint plugin which check whether an attribute of resource match the given naming convention.
$ git clone https://github.com/RossyWhite/tflint-naming-convention
$ make install
conventions.json
defines a set of naming rules which is applied to your terraform resources.
The rules can be written by using regex.
The config file must be placed in ~/.tflint.d/configs/
or ./.tflint.d/configs/
(working directory when tflint
command is executed)
example is available here.
Add following snippet to .tflint.hcl
plugin "naming_convention" {
enabled = true
}
Just run tflint
. an example output is shown below
Error: aws_sns_topic.name does not match pattern `.*-topic$` (one_name)
on resource.tf line 7:
7: name = "my-topik" # <= mistake
Reference: https://github.com/RossyWhite/tflint-naming-convention