Skip to content

Commit 02d2bed

Browse files
ShibraAmin18nitin-yadav-sq
authored andcommitted
Stable branch
1 parent 8d2d9f4 commit 02d2bed

18 files changed

+1542
-87
lines changed

.gitignore

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
2+
*.out
3+
*.lock
4+
*.tfvars
5+
*.pem
6+
*.txt
7+
8+
# Local .terraform directories
9+
**/.terraform/*
10+
.terraform*
11+
12+
# .tfstate files
13+
*.tfstate
14+
*.tfstate.*
15+
16+
# Crash log files
17+
crash.log
18+
crash.*.log
19+
20+
*.tfvars
21+
*.tfvars.json
22+
23+
# Ignore override files as they are usually used to override resources locally and so
24+
# are not checked in
25+
override.tf
26+
override.tf.json
27+
*_override.tf
28+
*_override.tf.json
29+
30+
# Ignore CLI configuration files
31+
.terraformrc
32+
terraform.rc

.pre-commit-config.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.1.0
4+
hooks:
5+
- id: trailing-whitespace
6+
args: ['--markdown-linebreak-ext=md']
7+
- id: end-of-file-fixer
8+
- id: check-merge-conflict
9+
- id: detect-private-key
10+
- id: detect-aws-credentials
11+
args: ['--allow-missing-credentials']
12+
- repo: https://github.com/antonbabenko/pre-commit-terraform
13+
rev: v1.77.0
14+
hooks:
15+
- id: terraform_fmt
16+
- id: terraform_docs
17+
args:
18+
- '--args=--lockfile=false'
19+
- --hook-config=--add-to-existing-file=true
20+
- --hook-config=--create-file-if-not-exist=true
21+
22+
- id: terraform_tflint
23+
args:
24+
- --args=--config=.tflint.hcl
25+
- id: terraform_tfsec
26+
files: ^examples/ # only scan `examples/*` which are the implementation
27+
args:
28+
- --args=--config-file=__GIT_WORKING_DIR__/tfsec.yaml
29+
- --args=--concise-output

.tflint.hcl

+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
plugin "aws" {
2+
enabled = true
3+
version = "0.14.0"
4+
source = "github.com/terraform-linters/tflint-ruleset-aws"
5+
}
6+
7+
config {
8+
#Enables module inspection
9+
module = false
10+
force = false
11+
}
12+
13+
# Required that all AWS resources have specified tags.
14+
rule "aws_resource_missing_tags" {
15+
enabled = true
16+
tags = [
17+
"Name",
18+
"Environment",
19+
]
20+
}
21+
22+
# Disallow deprecated (0.11-style) interpolation
23+
rule "terraform_deprecated_interpolation" {
24+
enabled = true
25+
}
26+
27+
# Disallow legacy dot index syntax.
28+
rule "terraform_deprecated_index" {
29+
enabled = true
30+
}
31+
32+
# Disallow variables, data sources, and locals that are declared but never used.
33+
rule "terraform_unused_declarations" {
34+
enabled = true
35+
}
36+
37+
# Disallow // comments in favor of #.
38+
rule "terraform_comment_syntax" {
39+
enabled = false
40+
}
41+
42+
# Disallow output declarations without description.
43+
rule "terraform_documented_outputs" {
44+
enabled = true
45+
}
46+
47+
# Disallow variable declarations without description.
48+
rule "terraform_documented_variables" {
49+
enabled = true
50+
}
51+
52+
# Disallow variable declarations without type.
53+
rule "terraform_typed_variables" {
54+
enabled = true
55+
}
56+
57+
# Disallow specifying a git or mercurial repository as a module source without pinning to a version.
58+
rule "terraform_module_pinned_source" {
59+
enabled = true
60+
}
61+
62+
# Enforces naming conventions
63+
rule "terraform_naming_convention" {
64+
enabled = true
65+
66+
#Require specific naming structure
67+
variable {
68+
format = "snake_case"
69+
}
70+
71+
locals {
72+
format = "snake_case"
73+
}
74+
75+
output {
76+
format = "snake_case"
77+
}
78+
79+
#Allow any format
80+
resource {
81+
format = "none"
82+
}
83+
84+
module {
85+
format = "none"
86+
}
87+
88+
data {
89+
format = "none"
90+
}
91+
92+
}
93+
94+
# Disallow terraform declarations without require_version.
95+
rule "terraform_required_version" {
96+
enabled = true
97+
}
98+
99+
# Require that all providers have version constraints through required_providers.
100+
rule "terraform_required_providers" {
101+
enabled = true
102+
}
103+
104+
# Ensure that a module complies with the Terraform Standard Module Structure
105+
rule "terraform_standard_module_structure" {
106+
enabled = true
107+
}
108+
109+
# terraform.workspace should not be used with a "remote" backend with remote execution.
110+
rule "terraform_workspace_remote" {
111+
enabled = true
112+
}

0 commit comments

Comments
 (0)