File tree Expand file tree Collapse file tree 7 files changed +89
-29
lines changed Expand file tree Collapse file tree 7 files changed +89
-29
lines changed Original file line number Diff line number Diff line change 9
9
pass_filenames : false
10
10
stages : ["commit", "push"]
11
11
- repo : https://github.com/pre-commit/pre-commit-hooks
12
- rev : v4.5 .0
12
+ rev : v4.6 .0
13
13
hooks :
14
14
- id : check-merge-conflict
15
15
- id : end-of-file-fixer
16
16
- repo : https://github.com/antonbabenko/pre-commit-terraform
17
- rev : v1.83.6
17
+ rev : v1.88.4
18
18
hooks :
19
19
- id : terraform_fmt
20
20
- id : terraform_validate
Original file line number Diff line number Diff line change 1
1
# Template repo for Terraform modules
2
2
3
3
This repository contains my template for creating Terraform modules, yes even my
4
- root modules.
4
+ root modules. This template is based on the best practices I have learned and
5
+ the
6
+ [ HashiCorp style guide] ( https://developer.hashicorp.com/terraform/language/style ) .
5
7
6
8
## Tools that I use
7
9
@@ -49,13 +51,14 @@ commit process.
49
51
JSON processor. required for ` terraform_validate ` with
50
52
` --retry-once-with-cleanup ` flag, and for ` infracost_breakdown ` hook.
51
53
- ` brew install jq `
54
+ - [ TFLint] ( https://github.com/terraform-linters/tflint ) : A Terraform linter that
55
+ checks for best practices and errors in your Terraform code.
56
+ - ` brew install tflint `
52
57
- One or more of these terraform security scanning tools
53
58
- [ checkov] ( https://github.com/bridgecrewio/checkov )
54
59
- ` brew install checkov `
55
60
- [ terrascan] ( https://github.com/tenable/terrascan )
56
61
- ` brew install terrascan `
57
- - [ TFLint] ( https://github.com/terraform-linters/tflint )
58
- - ` brew install tflint `
59
62
- [ TFSec] ( https://tfsec.dev )
60
63
- ` brew install tfsec `
61
64
Original file line number Diff line number Diff line change
1
+ # ##############################################################################
2
+ # backend.tf
3
+ #
4
+ # Contains your backend configuration
5
+ # ##############################################################################
6
+
7
+ # Documentation
8
+ # https://developer.hashicorp.com/terraform/language/settings/backends/configuration
9
+
10
+ # terraform {
11
+ # backend "remote" {
12
+ # organization = "example_corp"
13
+
14
+ # workspaces {
15
+ # name = "my-app-prod"
16
+ # }
17
+ # }
18
+ # }
19
+
20
+ # Terraform Cloud storage block for CLI driven
21
+ # https://developer.hashicorp.com/terraform/language/settings/terraform-cloud
22
+
23
+ # terraform {
24
+ # cloud {
25
+ # organization = "example_corp"
26
+ # ## Required for Terraform Enterprise; Defaults to app.terraform.io for Terraform Cloud
27
+ # hostname = "app.terraform.io"
28
+
29
+ # workspaces {
30
+ # tags = ["app"]
31
+ # }
32
+ # }
33
+ # }
Original file line number Diff line number Diff line change 1
- # ###########################
1
+ # ##############################################################################
2
2
# outputs.tf
3
3
#
4
- # Module outputs
5
- # ###########################
4
+ # Module outputs in alphabetical order
5
+ # ##############################################################################
6
+
7
+ # output "web_public_ip" {
8
+ # description = "Public IP of the web instance"
9
+ # value = aws_instance.web.public_ip
10
+ # sensitive = true
11
+ # }
Original file line number Diff line number Diff line change
1
+ # ##############################################################################
2
+ # providers.tf
3
+ #
4
+ # Contains all provider blocks and configuration.
5
+ # ##############################################################################
6
+
7
+ provider "google" {
8
+ # Configuration options
9
+ # Environment variables needed for auth
10
+ # GOOGLE_OAUTH_ACCESS_TOKEN="..."
11
+ # GOOGLE_PROJECT="..."
12
+ # GOOGLE_REGION="..."
13
+ # GOOGLE_ZONE="..."
14
+ }
15
+
16
+ provider "hcp" {
17
+ # Configuration options
18
+ # Environment variables needed for auth
19
+ # HCP_CLIENT_ID="..."
20
+ # HCP_CLIENT_SECRET="..."
21
+ }
Original file line number Diff line number Diff line change 1
1
# ##############################################################################
2
2
# terraform.tf
3
3
#
4
- # Terraform and Provider blocks
4
+ # Contains a single terraform block which defines your required_version and
5
+ # required_providers.
5
6
# ##############################################################################
6
7
7
8
terraform {
@@ -17,19 +18,3 @@ terraform {
17
18
}
18
19
}
19
20
}
20
-
21
- provider "google" {
22
- # Configuration options
23
- # Environment variables needed for auth
24
- # GOOGLE_OAUTH_ACCESS_TOKEN="..."
25
- # GOOGLE_PROJECT="..."
26
- # GOOGLE_REGION="..."
27
- # GOOGLE_ZONE="..."
28
- }
29
-
30
- provider "hcp" {
31
- # Configuration options
32
- # Environment variables needed for auth
33
- # HCP_CLIENT_ID="..."
34
- # HCP_CLIENT_SECRET="..."
35
- }
Original file line number Diff line number Diff line change 1
1
# ##############################################################################
2
2
# variables.tf
3
3
#
4
- # Variable definitions
4
+ # Contains all variable blocks in alphabetical order
5
+ #
6
+ # Two groups Required (no default values)
7
+ # Optional (has a default value)
5
8
# ##############################################################################
6
9
10
+ # ##############################################################################
7
11
# Required Variables (no default values)
8
- # variable "environment" {
12
+ # ##############################################################################
13
+ # variable "image_id" {
9
14
# type = string
10
- # description = "Application Environment (dev|prod)"
15
+ # description = "The id of the machine image (AMI) to use for the server."
16
+
17
+ # validation {
18
+ # condition = length(var.image_id) > 4 && substr(var.image_id, 0, 4) == "ami-"
19
+ # error_message = "The image_id value must be a valid AMI id, starting with \"ami-\"."
20
+ # }
11
21
# }
12
22
13
- # Variables with Defaults
23
+ # ##############################################################################
24
+ # Optional Variables (has a default value)
25
+ # ##############################################################################
14
26
# variable "instance_type" {
15
27
# type = string
16
28
# description = "Instance Type"
You can’t perform that action at this time.
0 commit comments