Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added tflint as pre-commit hook #507

Merged
merged 3 commits into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .kitchen.yml

This file was deleted.

7 changes: 5 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.31.0
rev: v1.40.0
hooks:
- id: terraform_fmt
- id: terraform_docs
- id: terraform_tflint
args:
- '--args=--config=__GIT_WORKING_DIR__/.tflint.hcl'
- repo: git://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
rev: v3.2.0
hooks:
- id: check-merge-conflict
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

57 changes: 57 additions & 0 deletions .tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
config {
deep_check = false
ignore_module = {}
varfile = []
}

rule "terraform_deprecated_interpolation" {
enabled = true
}

rule "terraform_deprecated_index" {
enabled = true
}

rule "terraform_unused_declarations" {
enabled = true
}

rule "terraform_comment_syntax" {
enabled = true
}

rule "terraform_documented_outputs" {
enabled = true
}

rule "terraform_documented_variables" {
enabled = true
}

rule "terraform_typed_variables" {
enabled = true
}

rule "terraform_module_pinned_source" {
enabled = true
}

rule "terraform_naming_convention" {
enabled = true
}

rule "terraform_required_version" {
enabled = true
}

rule "terraform_required_providers" {
enabled = true
}

rule "terraform_standard_module_structure" {
enabled = true
}

rule "terraform_workspace_remote" {
enabled = true
}
11 changes: 0 additions & 11 deletions Gemfile

This file was deleted.

48 changes: 18 additions & 30 deletions README.md

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions examples/complete-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

| Name | Version |
|------|---------|
| aws | n/a |
| aws | >= 2.68, < 4.0 |

## Inputs

Expand Down
17 changes: 0 additions & 17 deletions examples/complete-vpc/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,20 +67,3 @@ output "this_customer_gateway" {
description = "Map of Customer Gateway attributes"
value = module.vpc.this_customer_gateway
}

//
//# VPC endpoints
//output "vpc_endpoint_ec2_id" {
// description = "The ID of VPC endpoint for EC2"
// value = "${module.vpc.vpc_endpoint_ec2_id}"
//}
//
//output "vpc_endpoint_ec2_network_interface_ids" {
// description = "One or more network interfaces for the VPC Endpoint for EC2."
// value = ["${module.vpc.vpc_endpoint_ec2_network_interface_ids}"]
//}
//
//output "vpc_endpoint_ec2_dns_entry" {
// description = "The DNS entries for the VPC Endpoint for EC2."
// value = ["${module.vpc.vpc_endpoint_ec2_dns_entry}"]
//}
Empty file.
7 changes: 7 additions & 0 deletions examples/complete-vpc/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
7 changes: 5 additions & 2 deletions examples/ipv6/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

| Name | Version |
|------|---------|
| aws | n/a |
| aws | >= 2.68, < 4.0 |

## Inputs

Expand Down
Empty file added examples/ipv6/variables.tf
Empty file.
7 changes: 7 additions & 0 deletions examples/ipv6/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
5 changes: 4 additions & 1 deletion examples/issue-108-route-already-exists/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/issue-108-route-already-exists/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
46 changes: 0 additions & 46 deletions examples/issue-224-vpcendpoint-apigw/main.tf

This file was deleted.

5 changes: 4 additions & 1 deletion examples/issue-44-asymmetric-private-subnets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/issue-44-asymmetric-private-subnets/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
5 changes: 4 additions & 1 deletion examples/issue-46-no-private-subnets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/issue-46-no-private-subnets/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
5 changes: 4 additions & 1 deletion examples/manage-default-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/manage-default-vpc/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
5 changes: 4 additions & 1 deletion examples/network-acls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
5 changes: 0 additions & 5 deletions examples/network-acls/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ output "vpc_cidr_block" {
value = module.vpc.vpc_cidr_block
}

//output "vpc_ipv6_cidr_block" {
// description = "The IPv6 CIDR block"
// value = ["${module.vpc.vpc_ipv6_cidr_block}"]
//}

# Subnets
output "private_subnets" {
description = "List of IDs of private subnets"
Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/network-acls/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
5 changes: 4 additions & 1 deletion examples/secondary-cidr-blocks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

Expand Down
Empty file.
7 changes: 7 additions & 0 deletions examples/secondary-cidr-blocks/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
terraform {
required_version = ">= 0.12.7, < 0.14"

required_providers {
aws = ">= 2.68, < 4.0"
}
}
9 changes: 5 additions & 4 deletions examples/simple-vpc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ Note that this example may create resources which can cost money (AWS Elastic IP
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements

No requirements.
| Name | Version |
|------|---------|
| terraform | >= 0.12.7, < 0.14 |
| aws | >= 2.68, < 4.0 |

## Providers

| Name | Version |
|------|---------|
| aws | n/a |
No provider.

## Inputs

Expand Down
5 changes: 0 additions & 5 deletions examples/simple-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ provider "aws" {
region = "eu-west-1"
}

data "aws_security_group" "default" {
name = "default"
vpc_id = module.vpc.vpc_id
}

module "vpc" {
source = "../../"

Expand Down
Loading