Skip to content

Commit 68ec4f8

Browse files
authored
feat: Added tflint as pre-commit hook (#507)
1 parent 0c2e8e0 commit 68ec4f8

File tree

51 files changed

+240
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+240
-306
lines changed

.kitchen.yml

Lines changed: 0 additions & 20 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
repos:
22
- repo: git://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.31.0
3+
rev: v1.40.0
44
hooks:
55
- id: terraform_fmt
66
- id: terraform_docs
7+
- id: terraform_tflint
8+
args:
9+
- '--args=--config=__GIT_WORKING_DIR__/.tflint.hcl'
710
- repo: git://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.1.0
11+
rev: v3.2.0
912
hooks:
1013
- id: check-merge-conflict

.ruby-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

.tflint.hcl

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
config {
2+
deep_check = false
3+
ignore_module = {}
4+
varfile = []
5+
}
6+
7+
rule "terraform_deprecated_interpolation" {
8+
enabled = true
9+
}
10+
11+
rule "terraform_deprecated_index" {
12+
enabled = true
13+
}
14+
15+
rule "terraform_unused_declarations" {
16+
enabled = true
17+
}
18+
19+
rule "terraform_comment_syntax" {
20+
enabled = true
21+
}
22+
23+
rule "terraform_documented_outputs" {
24+
enabled = true
25+
}
26+
27+
rule "terraform_documented_variables" {
28+
enabled = true
29+
}
30+
31+
rule "terraform_typed_variables" {
32+
enabled = true
33+
}
34+
35+
rule "terraform_module_pinned_source" {
36+
enabled = true
37+
}
38+
39+
rule "terraform_naming_convention" {
40+
enabled = true
41+
}
42+
43+
rule "terraform_required_version" {
44+
enabled = true
45+
}
46+
47+
rule "terraform_required_providers" {
48+
enabled = true
49+
}
50+
51+
rule "terraform_standard_module_structure" {
52+
enabled = true
53+
}
54+
55+
rule "terraform_workspace_remote" {
56+
enabled = true
57+
}

Gemfile

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 18 additions & 30 deletions
Large diffs are not rendered by default.

examples/complete-vpc/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1919
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2020
## Requirements
2121

22-
No requirements.
22+
| Name | Version |
23+
|------|---------|
24+
| terraform | >= 0.12.7, < 0.14 |
25+
| aws | >= 2.68, < 4.0 |
2326

2427
## Providers
2528

2629
| Name | Version |
2730
|------|---------|
28-
| aws | n/a |
31+
| aws | >= 2.68, < 4.0 |
2932

3033
## Inputs
3134

examples/complete-vpc/outputs.tf

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,3 @@ output "this_customer_gateway" {
6767
description = "Map of Customer Gateway attributes"
6868
value = module.vpc.this_customer_gateway
6969
}
70-
71-
//
72-
//# VPC endpoints
73-
//output "vpc_endpoint_ec2_id" {
74-
// description = "The ID of VPC endpoint for EC2"
75-
// value = "${module.vpc.vpc_endpoint_ec2_id}"
76-
//}
77-
//
78-
//output "vpc_endpoint_ec2_network_interface_ids" {
79-
// description = "One or more network interfaces for the VPC Endpoint for EC2."
80-
// value = ["${module.vpc.vpc_endpoint_ec2_network_interface_ids}"]
81-
//}
82-
//
83-
//output "vpc_endpoint_ec2_dns_entry" {
84-
// description = "The DNS entries for the VPC Endpoint for EC2."
85-
// value = ["${module.vpc.vpc_endpoint_ec2_dns_entry}"]
86-
//}

examples/complete-vpc/variables.tf

Whitespace-only changes.

examples/complete-vpc/versions.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/ipv6/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,16 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1717
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
1818
## Requirements
1919

20-
No requirements.
20+
| Name | Version |
21+
|------|---------|
22+
| terraform | >= 0.12.7, < 0.14 |
23+
| aws | >= 2.68, < 4.0 |
2124

2225
## Providers
2326

2427
| Name | Version |
2528
|------|---------|
26-
| aws | n/a |
29+
| aws | >= 2.68, < 4.0 |
2730

2831
## Inputs
2932

examples/ipv6/variables.tf

Whitespace-only changes.

examples/ipv6/versions.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/issue-108-route-already-exists/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2121
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2222
## Requirements
2323

24-
No requirements.
24+
| Name | Version |
25+
|------|---------|
26+
| terraform | >= 0.12.7, < 0.14 |
27+
| aws | >= 2.68, < 4.0 |
2528

2629
## Providers
2730

examples/issue-108-route-already-exists/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/issue-224-vpcendpoint-apigw/main.tf

Lines changed: 0 additions & 46 deletions
This file was deleted.

examples/issue-44-asymmetric-private-subnets/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1919
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2020
## Requirements
2121

22-
No requirements.
22+
| Name | Version |
23+
|------|---------|
24+
| terraform | >= 0.12.7, < 0.14 |
25+
| aws | >= 2.68, < 4.0 |
2326

2427
## Providers
2528

examples/issue-44-asymmetric-private-subnets/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/issue-46-no-private-subnets/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1919
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2020
## Requirements
2121

22-
No requirements.
22+
| Name | Version |
23+
|------|---------|
24+
| terraform | >= 0.12.7, < 0.14 |
25+
| aws | >= 2.68, < 4.0 |
2326

2427
## Providers
2528

examples/issue-46-no-private-subnets/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/manage-default-vpc/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Run `terraform destroy` when you don't need these resources.
1919
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2020
## Requirements
2121

22-
No requirements.
22+
| Name | Version |
23+
|------|---------|
24+
| terraform | >= 0.12.7, < 0.14 |
25+
| aws | >= 2.68, < 4.0 |
2326

2427
## Providers
2528

examples/manage-default-vpc/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/network-acls/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2121
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2222
## Requirements
2323

24-
No requirements.
24+
| Name | Version |
25+
|------|---------|
26+
| terraform | >= 0.12.7, < 0.14 |
27+
| aws | >= 2.68, < 4.0 |
2528

2629
## Providers
2730

examples/network-acls/outputs.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ output "vpc_cidr_block" {
1010
value = module.vpc.vpc_cidr_block
1111
}
1212

13-
//output "vpc_ipv6_cidr_block" {
14-
// description = "The IPv6 CIDR block"
15-
// value = ["${module.vpc.vpc_ipv6_cidr_block}"]
16-
//}
17-
1813
# Subnets
1914
output "private_subnets" {
2015
description = "List of IDs of private subnets"

examples/network-acls/variables.tf

Whitespace-only changes.

examples/network-acls/versions.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/secondary-cidr-blocks/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
1919
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2020
## Requirements
2121

22-
No requirements.
22+
| Name | Version |
23+
|------|---------|
24+
| terraform | >= 0.12.7, < 0.14 |
25+
| aws | >= 2.68, < 4.0 |
2326

2427
## Providers
2528

examples/secondary-cidr-blocks/variables.tf

Whitespace-only changes.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
terraform {
2+
required_version = ">= 0.12.7, < 0.14"
3+
4+
required_providers {
5+
aws = ">= 2.68, < 4.0"
6+
}
7+
}

examples/simple-vpc/README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP
2323
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2424
## Requirements
2525

26-
No requirements.
26+
| Name | Version |
27+
|------|---------|
28+
| terraform | >= 0.12.7, < 0.14 |
29+
| aws | >= 2.68, < 4.0 |
2730

2831
## Providers
2932

30-
| Name | Version |
31-
|------|---------|
32-
| aws | n/a |
33+
No provider.
3334

3435
## Inputs
3536

examples/simple-vpc/main.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ provider "aws" {
22
region = "eu-west-1"
33
}
44

5-
data "aws_security_group" "default" {
6-
name = "default"
7-
vpc_id = module.vpc.vpc_id
8-
}
9-
105
module "vpc" {
116
source = "../../"
127

0 commit comments

Comments
 (0)