Skip to content

Commit c1ae241

Browse files
committed
version bumping and updating checks
1 parent 4828a3c commit c1ae241

File tree

11 files changed

+125
-88
lines changed

11 files changed

+125
-88
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* @rhythmictech/engineering
1+
* @sdickenson @cdaniluk

.github/workflows/pre-commit-check.yaml

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

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
# Local .terraform directories
22
**/.terraform/*
3+
**/terraform.d/*
34

45
# .tfstate files
56
*.tfstate
67
*.tfstate.*
8+
9+
# plans
10+
*.tfplan
11+
*.tfplan.txt
12+
13+
# override files
14+
override.tf*
15+
*_override.tf*
16+
17+
# temp files
18+
**/tmp/**
19+
**/builds

.pre-commit-config.yaml

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
1+
exclude: ".terraform"
12
repos:
23
- repo: https://github.com/antonbabenko/pre-commit-terraform
3-
rev: v1.31.0
4+
rev: v1.62.3
45
hooks:
56
- id: terraform_docs
67
always_run: true
7-
args:
8-
- --args=--sort-by-required
98
- id: terraform_fmt
10-
- id: terraform_tflint
11-
alias: terraform_tflint_deep
12-
name: terraform_tflint_deep
13-
args:
14-
- --args=--deep
159
- id: terraform_tflint
1610
alias: terraform_tflint_nocreds
1711
name: terraform_tflint_nocreds
@@ -33,14 +27,36 @@ repos:
3327
cd $(dirname "$FILE")
3428
terraform init --backend=false
3529
terraform validate .
30+
cd ..
31+
done
32+
'
33+
language: system
34+
verbose: true
35+
files: \.tf(vars)?$
36+
exclude: examples
37+
- id: tflock
38+
name: provider_locks
39+
entry: |
40+
bash -c '
41+
AWS_DEFAULT_REGION=us-east-1
42+
declare -a DIRS
43+
for FILE in "$@"
44+
do
45+
DIRS+=($(dirname "$FILE"))
46+
done
47+
for DIR in $(printf "%s\n" "${DIRS[@]}" | sort -u)
48+
do
49+
cd $(dirname "$FILE")
50+
terraform providers lock -platform=windows_amd64 -platform=darwin_amd64 -platform=linux_amd64
51+
cd ..
3652
done
3753
'
3854
language: system
3955
verbose: true
4056
files: \.tf(vars)?$
4157
exclude: examples
4258
- repo: https://github.com/pre-commit/pre-commit-hooks
43-
rev: v3.0.0
59+
rev: v4.1.0
4460
hooks:
4561
- id: check-case-conflict
4662
- id: check-json
@@ -50,11 +66,17 @@ repos:
5066
args:
5167
- --unsafe
5268
- id: end-of-file-fixer
53-
- id: trailing-whitespace
5469
- id: mixed-line-ending
5570
args:
5671
- --fix=lf
5772
- id: no-commit-to-branch
73+
args:
74+
- --branch
75+
- main
76+
- --branch
77+
- master
78+
- --branch
79+
- prod
5880
- id: pretty-format-json
5981
args:
6082
- --autofix
@@ -63,3 +85,5 @@ repos:
6385
args:
6486
- --markdown-linebreak-ext=md
6587
exclude: README.md
88+
ci:
89+
skip: [terraform_docs, terraform_fmt, terraform_tflint, terraform_tfsec, tflock]

.terraform-version

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

.tflint.hcl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
config {
22
module = true
3-
deep_check = false
43
}
54

65
rule "terraform_deprecated_interpolation" {

.yamllint.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
truthy:
2+
check-keys: false

README.md

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# terraform-aws-backend
2-
[![](https://github.com/rhythmictech/terraform-aws-backend/workflows/pre-commit-check/badge.svg)](https://github.com/rhythmictech/terraform-aws-backend/actions) <a href="https://twitter.com/intent/follow?screen_name=RhythmicTech"><img src="https://img.shields.io/twitter/follow/RhythmicTech?style=social&logo=RhythmicTech" alt="follow on Twitter"></a>
2+
3+
[![tflint](https://github.com/rhythmictech/terraform-aws-backend/workflows/tflint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-aws-backend/actions?query=workflow%3Atflint+event%3Apush+branch%3Amaster)
4+
[![tfsec](https://github.com/rhythmictech/terraform-aws-backend/workflows/tfsec/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-aws-backend/actions?query=workflow%3Atfsec+event%3Apush+branch%3Amaster)
5+
[![yamllint](https://github.com/rhythmictech/terraform-aws-backend/workflows/yamllint/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-aws-backend/actions?query=workflow%3Ayamllint+event%3Apush+branch%3Amaster)
6+
[![misspell](https://github.com/rhythmictech/terraform-aws-backend/workflows/misspell/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-aws-backend/actions?query=workflow%3Amisspell+event%3Apush+branch%3Amaster)
7+
[![pre-commit-check](https://github.com/rhythmictech/terraform-aws-backend/workflows/pre-commit-check/badge.svg?branch=master&event=push)](https://github.com/rhythmictech/terraform-aws-backend/actions?query=workflow%3Apre-commit-check+event%3Apush+branch%3Amaster)
8+
<a href="https://twitter.com/intent/follow?screen_name=RhythmicTech"><img src="https://img.shields.io/twitter/follow/RhythmicTech?style=social&logo=twitter" alt="follow on Twitter"></a>
39

410
Creates a backend S3 bucket and DynamoDB table for managing Terraform state. Useful for bootstrapping a new
511
environment. This module supports cross-account state management, using a centralized account that holds the S3 bucket and KMS key.
@@ -58,34 +64,51 @@ region = "us-east-1"
5864

5965
| Name | Version |
6066
|------|---------|
61-
| terraform | >= 0.13 |
62-
| aws | ~> 3.15.0 |
67+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
68+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15.0 |
6369

6470
## Providers
6571

6672
| Name | Version |
6773
|------|---------|
68-
| aws | ~> 3.15.0 |
74+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15.0 |
75+
76+
## Modules
77+
78+
No modules.
79+
80+
## Resources
81+
82+
| Name | Type |
83+
|------|------|
84+
| [aws_dynamodb_table.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/dynamodb_table) | resource |
85+
| [aws_kms_alias.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_alias) | resource |
86+
| [aws_kms_key.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
87+
| [aws_s3_bucket.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket) | resource |
88+
| [aws_s3_bucket_policy.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy) | resource |
89+
| [aws_s3_bucket_public_access_block.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_public_access_block) | resource |
90+
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |
91+
| [aws_iam_policy_document.key](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
92+
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
6993

7094
## Inputs
7195

7296
| Name | Description | Type | Default | Required |
7397
|------|-------------|------|---------|:--------:|
74-
| allowed\_account\_ids | Account IDs that are allowed to access the bucket/KMS key | `list(string)` | `[]` | no |
75-
| bucket | Name of bucket to create (do not provide if using `remote_bucket`) | `string` | `""` | no |
76-
| kms\_alias\_name | Name of KMS Alias | `string` | `""` | no |
77-
| kms\_key\_id | ARN for KMS key for all encryption operations. | `string` | `""` | no |
78-
| logging\_target\_bucket | The name of the bucket that will receive the log objects | `string` | `null` | no |
79-
| logging\_target\_prefix | A key prefix for log objects | `string` | `"TFStateLogs/"` | no |
80-
| remote\_bucket | If specified, the remote bucket will be used for the backend. A new bucket will not be created | `string` | `""` | no |
81-
| table | Name of Dynamo Table to create | `string` | `"tf-locktable"` | no |
82-
| tags | Mapping of any extra tags you want added to resources | `map(string)` | `{}` | no |
98+
| <a name="input_allowed_account_ids"></a> [allowed\_account\_ids](#input\_allowed\_account\_ids) | Account IDs that are allowed to access the bucket/KMS key | `list(string)` | `[]` | no |
99+
| <a name="input_bucket"></a> [bucket](#input\_bucket) | Name of bucket to create (do not provide if using `remote_bucket`) | `string` | `""` | no |
100+
| <a name="input_kms_alias_name"></a> [kms\_alias\_name](#input\_kms\_alias\_name) | Name of KMS Alias | `string` | `""` | no |
101+
| <a name="input_kms_key_id"></a> [kms\_key\_id](#input\_kms\_key\_id) | ARN for KMS key for all encryption operations. | `string` | `""` | no |
102+
| <a name="input_logging_target_bucket"></a> [logging\_target\_bucket](#input\_logging\_target\_bucket) | The name of the bucket that will receive the log objects | `string` | `null` | no |
103+
| <a name="input_logging_target_prefix"></a> [logging\_target\_prefix](#input\_logging\_target\_prefix) | A key prefix for log objects | `string` | `"TFStateLogs/"` | no |
104+
| <a name="input_remote_bucket"></a> [remote\_bucket](#input\_remote\_bucket) | If specified, the remote bucket will be used for the backend. A new bucket will not be created | `string` | `""` | no |
105+
| <a name="input_table"></a> [table](#input\_table) | Name of Dynamo Table to create | `string` | `"tf-locktable"` | no |
106+
| <a name="input_tags"></a> [tags](#input\_tags) | Mapping of any extra tags you want added to resources | `map(string)` | `{}` | no |
83107

84108
## Outputs
85109

86110
| Name | Description |
87111
|------|-------------|
88-
| kms\_key\_arn | ARN of KMS Key for S3 bucket |
89-
| s3\_bucket\_backend | S3 bucket |
90-
112+
| <a name="output_kms_key_arn"></a> [kms\_key\_arn](#output\_kms\_key\_arn) | ARN of KMS Key for S3 bucket |
113+
| <a name="output_s3_bucket_backend"></a> [s3\_bucket\_backend](#output\_s3\_bucket\_backend) | S3 bucket |
91114
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

bin/install-macos.sh

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

bin/update-provider.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
4+
linux_plugin_dir="terraform.d/plugins/linux_amd64/"
5+
mac_plugin_dir="terraform.d/plugins/darwin_amd64"
6+
7+
if [ -z "${1}" ]
8+
then
9+
# Default to 2.0.3
10+
version="2.0.3"
11+
else
12+
# Get specific version
13+
version="${1}"
14+
fi
15+
16+
# Delete old versions
17+
[ -d $linux_plugin_dir ] && rm $linux_plugin_dir/*
18+
[ -d $mac_plugin_dir ] && rm $mac_plugin_dir/*
19+
20+
# if it doesn't exist
21+
# then create plugin dir
22+
[ ! -d $linux_plugin_dir ] && mkdir -p $linux_plugin_dir
23+
[ ! -d $mac_plugin_dir ] && mkdir -p $mac_plugin_dir
24+
25+
# Download Linux provider
26+
curl -sSL -o \
27+
"$linux_plugin_dir/terraform-provider-errorcheck_v${version}" \
28+
"https://github.com/rhythmictech/terraform-provider-errorcheck/releases/download/${version}/terraform-provider-errorcheck_v${version}_linux_amd64"
29+
chmod 0744 $linux_plugin_dir/*
30+
31+
# Download Mac provider
32+
curl -sSL -o \
33+
"$mac_plugin_dir/terraform-provider-errorcheck_v${version}" \
34+
"https://github.com/rhythmictech/terraform-provider-errorcheck/releases/download/${version}/terraform-provider-errorcheck_v${version}_darwin_amd64"
35+
chmod 0744 $mac_plugin_dir/*

0 commit comments

Comments
 (0)