Skip to content

Commit

Permalink
feat!: terraform 0.13 support (#118)
Browse files Browse the repository at this point in the history
* chore: updated terraform-docs to 0.13.x

* ci: use terraform 0.13 for formatting

* ci: validate using terraform 0.12 and 0.13

* feat: allow terraform 0.13

* docs: allow terraform 0.13

* ci: don't interrupt jobs when just one terraform version fails

* ci: cache the whole plugins dir

* ci: -plugin-dir behaves differently since 0.13

* ci: indicate which modules failed

* ci: extracted tools/bin/check-all-docs out of the workflow

* ci: extracted tools/validate-module from the workflow

* ci: missing newline in validate-module

* docs(lambda): moved invoke example to a separate directory

* feat(lambda)!: removed invoke_script output, added lambda/bin/invoke

Replaced invoke_script with lambda/bin/invoke script which you should call yourself. Updated examples to use the new script.
Solves destroy-time provisioner errors.

* feat(rds/postgres): updated postgres version

* docs(rds/postgres): fixed wrong lambda name

* docs(lambda): make sure invoke scripts run after the lambda is created

* docs(rds/postgres): mask db password

* ci: force build
  • Loading branch information
mskrajnowski committed Jun 10, 2021
1 parent ec8c9ca commit 67f8ba9
Show file tree
Hide file tree
Showing 119 changed files with 388 additions and 274 deletions.
139 changes: 74 additions & 65 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,43 +10,17 @@ env:
AWS_REGION: eu-west-1

jobs:
providers:
name: Make sure providers are cached
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

# https://github.com/marketplace/actions/hashicorp-setup-terraform
- name: Setup Terraform 0.12.x
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.x

- name: Setup providers cache
id: cache_providers
uses: actions/cache@v2
with:
path: ./.terraform/plugins/linux_amd64
key: ${{ runner.os }}-terraform-providers-${{ hashFiles('./versions.tf') }}
restore-keys: ${{ runner.os }}-terraform-providers

- name: Download providers
id: download_providers
if: steps.cache_providers.outputs.cache-hit != 'true'
run: terraform init -backend=false

terraform-fmt:
name: Check formatting
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Terraform 0.12.x
- name: Setup Terraform 0.13.x
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.x
terraform_version: 0.13.x

- name: terraform fmt
run: terraform fmt -recursive -check -diff
Expand Down Expand Up @@ -75,77 +49,112 @@ jobs:
echo /tmp/terraform-docs/bin >>$GITHUB_PATH
- name: terraform docs
run: |
mapfile -t modules < <(tools/bin/find-modules)
run: tools/bin/check-all-docs

download_providers:
runs-on: ubuntu-20.04

for module in "${modules[@]}"; do
echo "::group::$module"
tools/bin/check-docs "$module/README.md"
echo "::endgroup::"
done
strategy:
fail-fast: false
matrix:
tf_version:
- "0.12.x"
- "0.13.x"

name: "[terraform ${{ matrix.tf_version }}] Download providers"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: ${{ matrix.tf_version }}

- name: Setup providers cache
id: cache_providers
uses: actions/cache@v2
with:
path: ./.terraform/plugins
key: ${{ runner.os }}-terraform-${{ matrix.tf_version }}-providers-${{ hashFiles('./versions.tf') }}

- name: Download providers
id: download_providers
if: steps.cache_providers.outputs.cache-hit != 'true'
run: terraform init -backend=false

terraform-validate-modules:
name: Validate modules
needs: [providers]
needs: [download_providers]
runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
tf_version:
- "0.12.x"
- "0.13.x"

name: "[terraform ${{ matrix.tf_version }}] Validate modules"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Terraform 0.12.x
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.x
terraform_version: ${{ matrix.tf_version }}

- name: Download cached providers
uses: codequest-eu/restore-cache-action@master
with:
path: ./.terraform/plugins/linux_amd64
key: ${{ runner.os }}-terraform-providers-${{ hashFiles('./versions.tf') }}
path: ./.terraform/plugins
key: ${{ runner.os }}-terraform-${{ matrix.tf_version }}-providers-${{ hashFiles('./versions.tf') }}

- name: terraform validate
run: |
plugins="$PWD/.terraform/plugins/linux_amd64"
case '${{ matrix.tf_version }}' in
0.12.*) plugins="$PWD/.terraform/plugins/linux_amd64" ;;
*) plugins="$PWD/.terraform/plugins" ;;
esac
tools/bin/find-modules | parallel --keep-order "
set -e
export TF_CLI_ARGS_init="-plugin-dir='$plugins'"
echo '::group::{}'
cd {}
terraform init -backend=false -plugin-dir='$plugins'
terraform validate
echo '::endgroup::'
"
tools/bin/validate-all-modules
terraform-validate-examples:
name: Validate examples
needs: [providers]
needs: [download_providers]
runs-on: ubuntu-20.04

strategy:
fail-fast: false
matrix:
tf_version:
- "0.12.x"
- "0.13.x"

name: "[terraform ${{ matrix.tf_version }}] Validate examples"
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Terraform 0.12.x
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 0.12.x
terraform_version: ${{ matrix.tf_version }}

- name: Download cached providers
uses: codequest-eu/restore-cache-action@master
with:
path: ./.terraform/plugins/linux_amd64
key: ${{ runner.os }}-terraform-providers-${{ hashFiles('./versions.tf') }}
path: ./.terraform/plugins
key: ${{ runner.os }}-terraform-${{ matrix.tf_version }}-providers-${{ hashFiles('./versions.tf') }}

- name: terraform validate
run: |
plugins="$PWD/.terraform/plugins/linux_amd64"
case '${{ matrix.tf_version }}' in
0.12.*) plugins="$PWD/.terraform/plugins/linux_amd64" ;;
*) plugins="$PWD/.terraform/plugins" ;;
esac
tools/bin/find-examples | parallel --keep-order "
set -e
export TF_CLI_ARGS_init="-plugin-dir='$plugins'"
echo '::group::{}'
cd {}
terraform init -backend=false -plugin-dir='$plugins'
terraform validate
echo '::endgroup::'
"
tools/bin/validate-all-examples
2 changes: 1 addition & 1 deletion .plop/module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.40.0 |

## Providers
Expand Down
2 changes: 1 addition & 1 deletion .plop/module/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
aws = ">= 2.40.0"
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AWS Cloudfront distribution

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.40.0 |

## Providers
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/behavior/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Behavior factory for the `cloudfront` module

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/behavior/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/invalidation/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
null = ">= 2.1.2"
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AWS Lambda middleware for AWS CloudFront

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |
| <a name="requirement_archive"></a> [archive](#requirement\_archive) | >= 1.2.2 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.40.0 |

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/lambda/basic_auth/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Basic authentication middleware for AWS CloudFront

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/lambda/basic_auth/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/lambda/pull_request_router/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Pull request router for AWS CloudFront. Serves the right `index.html` based on a

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/lambda/pull_request_router/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/lambda/response_headers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Consult the [example](../../examples/response_headers) for how it could be done

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/lambda/response_headers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/lambda/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
aws = ">= 2.40.0"
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/origin/http/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ HTTPS origin factory for the `cloudfront` module

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/origin/http/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/origin/s3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ S3 origin factory for the `cloudfront` module

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudfront/origin/s3/bucket_policy_document/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ S3 bucket policy to allow access from a cloudfront distribution

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.40.0 |

## Providers
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/origin/s3/bucket_policy_document/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
aws = ">= 2.40.0"
Expand Down
2 changes: 1 addition & 1 deletion cloudfront/origin/s3/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudfront/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
aws = ">= 2.40.0"
Expand Down
2 changes: 1 addition & 1 deletion cloudwatch/alarm_widget/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dash

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudwatch/alarm_widget/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudwatch/consts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Common cloudwatch-related constants, like the color palette cloudwatch uses by d

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |

## Providers

Expand Down
2 changes: 1 addition & 1 deletion cloudwatch/consts/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"
}
2 changes: 1 addition & 1 deletion cloudwatch/dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Creates a dashboard in cloudwatch with the given widgets.

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.13 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.12, <0.14 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 2.40.0 |

## Providers
Expand Down
2 changes: 1 addition & 1 deletion cloudwatch/dashboard/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12, <0.13"
required_version = ">= 0.12, <0.14"

required_providers {
aws = ">= 2.40.0"
Expand Down
Loading

0 comments on commit 67f8ba9

Please sign in to comment.