diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 80c4f8e4..ff90be77 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,32 +10,6 @@ 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 @@ -43,10 +17,10 @@ jobs: - 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 @@ -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 diff --git a/.plop/module/README.md b/.plop/module/README.md index eccc92a5..f535f259 100644 --- a/.plop/module/README.md +++ b/.plop/module/README.md @@ -7,7 +7,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/.plop/module/versions.tf b/.plop/module/versions.tf index f6b7188e..bf43a67d 100644 --- a/.plop/module/versions.tf +++ b/.plop/module/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/cloudfront/README.md b/cloudfront/README.md index 54ef9ea8..bcd1406e 100644 --- a/cloudfront/README.md +++ b/cloudfront/README.md @@ -7,7 +7,7 @@ AWS Cloudfront distribution | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/cloudfront/behavior/README.md b/cloudfront/behavior/README.md index 5db3ea0c..6fed6368 100644 --- a/cloudfront/behavior/README.md +++ b/cloudfront/behavior/README.md @@ -7,7 +7,7 @@ Behavior factory for the `cloudfront` module | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/behavior/versions.tf b/cloudfront/behavior/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/behavior/versions.tf +++ b/cloudfront/behavior/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/invalidation/versions.tf b/cloudfront/invalidation/versions.tf index a4a34c36..e019ecd1 100644 --- a/cloudfront/invalidation/versions.tf +++ b/cloudfront/invalidation/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { null = ">= 2.1.2" diff --git a/cloudfront/lambda/README.md b/cloudfront/lambda/README.md index 801abd9b..fbebbf56 100644 --- a/cloudfront/lambda/README.md +++ b/cloudfront/lambda/README.md @@ -7,7 +7,7 @@ AWS Lambda middleware for AWS CloudFront | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [archive](#requirement\_archive) | >= 1.2.2 | | [aws](#requirement\_aws) | >= 2.40.0 | diff --git a/cloudfront/lambda/basic_auth/README.md b/cloudfront/lambda/basic_auth/README.md index f7e54ce6..4312499d 100644 --- a/cloudfront/lambda/basic_auth/README.md +++ b/cloudfront/lambda/basic_auth/README.md @@ -7,7 +7,7 @@ Basic authentication middleware for AWS CloudFront | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/lambda/basic_auth/versions.tf b/cloudfront/lambda/basic_auth/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/lambda/basic_auth/versions.tf +++ b/cloudfront/lambda/basic_auth/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/lambda/pull_request_router/README.md b/cloudfront/lambda/pull_request_router/README.md index 85386e86..f62eb358 100644 --- a/cloudfront/lambda/pull_request_router/README.md +++ b/cloudfront/lambda/pull_request_router/README.md @@ -7,7 +7,7 @@ Pull request router for AWS CloudFront. Serves the right `index.html` based on a | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/lambda/pull_request_router/versions.tf b/cloudfront/lambda/pull_request_router/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/lambda/pull_request_router/versions.tf +++ b/cloudfront/lambda/pull_request_router/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/lambda/response_headers/README.md b/cloudfront/lambda/response_headers/README.md index 190b7c1a..7e7ba3c1 100644 --- a/cloudfront/lambda/response_headers/README.md +++ b/cloudfront/lambda/response_headers/README.md @@ -15,7 +15,7 @@ Consult the [example](../../examples/response_headers) for how it could be done | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/lambda/response_headers/versions.tf b/cloudfront/lambda/response_headers/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/lambda/response_headers/versions.tf +++ b/cloudfront/lambda/response_headers/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/lambda/versions.tf b/cloudfront/lambda/versions.tf index 9893f494..a92b1d57 100644 --- a/cloudfront/lambda/versions.tf +++ b/cloudfront/lambda/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/cloudfront/origin/http/README.md b/cloudfront/origin/http/README.md index 459ae16e..cafe0d29 100644 --- a/cloudfront/origin/http/README.md +++ b/cloudfront/origin/http/README.md @@ -7,7 +7,7 @@ HTTPS origin factory for the `cloudfront` module | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/origin/http/versions.tf b/cloudfront/origin/http/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/origin/http/versions.tf +++ b/cloudfront/origin/http/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/origin/s3/README.md b/cloudfront/origin/s3/README.md index ea9772d6..93d329f3 100644 --- a/cloudfront/origin/s3/README.md +++ b/cloudfront/origin/s3/README.md @@ -7,7 +7,7 @@ S3 origin factory for the `cloudfront` module | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudfront/origin/s3/bucket_policy_document/README.md b/cloudfront/origin/s3/bucket_policy_document/README.md index b2108d07..af57906c 100644 --- a/cloudfront/origin/s3/bucket_policy_document/README.md +++ b/cloudfront/origin/s3/bucket_policy_document/README.md @@ -7,7 +7,7 @@ S3 bucket policy to allow access from a cloudfront distribution | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/cloudfront/origin/s3/bucket_policy_document/versions.tf b/cloudfront/origin/s3/bucket_policy_document/versions.tf index db7202fa..c4d2a4f5 100644 --- a/cloudfront/origin/s3/bucket_policy_document/versions.tf +++ b/cloudfront/origin/s3/bucket_policy_document/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/cloudfront/origin/s3/versions.tf b/cloudfront/origin/s3/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudfront/origin/s3/versions.tf +++ b/cloudfront/origin/s3/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudfront/versions.tf b/cloudfront/versions.tf index db7202fa..c4d2a4f5 100644 --- a/cloudfront/versions.tf +++ b/cloudfront/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/cloudwatch/alarm_widget/README.md b/cloudwatch/alarm_widget/README.md index 4f108ea3..fe57f4a9 100644 --- a/cloudwatch/alarm_widget/README.md +++ b/cloudwatch/alarm_widget/README.md @@ -9,7 +9,7 @@ https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dash | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/alarm_widget/versions.tf b/cloudwatch/alarm_widget/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/alarm_widget/versions.tf +++ b/cloudwatch/alarm_widget/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/consts/README.md b/cloudwatch/consts/README.md index 4251cb9a..5be0d66a 100644 --- a/cloudwatch/consts/README.md +++ b/cloudwatch/consts/README.md @@ -7,7 +7,7 @@ Common cloudwatch-related constants, like the color palette cloudwatch uses by d | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/consts/versions.tf b/cloudwatch/consts/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/consts/versions.tf +++ b/cloudwatch/consts/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/dashboard/README.md b/cloudwatch/dashboard/README.md index 7102bcb5..39d7b068 100644 --- a/cloudwatch/dashboard/README.md +++ b/cloudwatch/dashboard/README.md @@ -7,7 +7,7 @@ Creates a dashboard in cloudwatch with the given widgets. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/cloudwatch/dashboard/versions.tf b/cloudwatch/dashboard/versions.tf index db7202fa..c4d2a4f5 100644 --- a/cloudwatch/dashboard/versions.tf +++ b/cloudwatch/dashboard/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/cloudwatch/metric/README.md b/cloudwatch/metric/README.md index 0ee8ef63..966c0362 100644 --- a/cloudwatch/metric/README.md +++ b/cloudwatch/metric/README.md @@ -5,7 +5,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/metric/many/README.md b/cloudwatch/metric/many/README.md index f8f45aca..610d440b 100644 --- a/cloudwatch/metric/many/README.md +++ b/cloudwatch/metric/many/README.md @@ -7,7 +7,7 @@ Same as [cloudwatch/metric](./..) but allows for creating many metrics using a s | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/metric/many/versions.tf b/cloudwatch/metric/many/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/metric/many/versions.tf +++ b/cloudwatch/metric/many/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/metric/versions.tf b/cloudwatch/metric/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/metric/versions.tf +++ b/cloudwatch/metric/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/metric_expression/README.md b/cloudwatch/metric_expression/README.md index 385d9c2a..b6bd76cd 100644 --- a/cloudwatch/metric_expression/README.md +++ b/cloudwatch/metric_expression/README.md @@ -5,7 +5,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/metric_expression/many/README.md b/cloudwatch/metric_expression/many/README.md index 3c1592e4..cf5fcdee 100644 --- a/cloudwatch/metric_expression/many/README.md +++ b/cloudwatch/metric_expression/many/README.md @@ -7,7 +7,7 @@ Same as [cloudwatch/metric_expression](./..) but allows for creating many metric | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/cloudwatch/metric_expression/many/versions.tf b/cloudwatch/metric_expression/many/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/metric_expression/many/versions.tf +++ b/cloudwatch/metric_expression/many/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/metric_expression/versions.tf b/cloudwatch/metric_expression/versions.tf index dc7c8e0e..309e41ae 100644 --- a/cloudwatch/metric_expression/versions.tf +++ b/cloudwatch/metric_expression/versions.tf @@ -1,3 +1,3 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" } diff --git a/cloudwatch/metric_widget/README.md b/cloudwatch/metric_widget/README.md index 42b9b694..a681e820 100644 --- a/cloudwatch/metric_widget/README.md +++ b/cloudwatch/metric_widget/README.md @@ -9,7 +9,7 @@ https://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/CloudWatch-Dash | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/cloudwatch/metric_widget/versions.tf b/cloudwatch/metric_widget/versions.tf index db7202fa..c4d2a4f5 100644 --- a/cloudwatch/metric_widget/versions.tf +++ b/cloudwatch/metric_widget/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/README.md b/ecs/README.md index 6cbf8c12..6d2d2dc8 100644 --- a/ecs/README.md +++ b/ecs/README.md @@ -39,7 +39,7 @@ Based on [AWS reference architecture](https://github.com/aws-samples/ecs-refarch | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/access/README.md b/ecs/access/README.md index dc87c187..aeb4bf98 100644 --- a/ecs/access/README.md +++ b/ecs/access/README.md @@ -7,7 +7,7 @@ Creates IAM resources needed to run host instances and services in the ECS clust | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/access/versions.tf b/ecs/access/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/access/versions.tf +++ b/ecs/access/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/host_group/README.md b/ecs/host_group/README.md index 59031b4b..f21756d4 100644 --- a/ecs/host_group/README.md +++ b/ecs/host_group/README.md @@ -7,7 +7,7 @@ Creates an auto-scaling group of EC2 instances which will join the given ECS clu | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/host_group/versions.tf b/ecs/host_group/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/host_group/versions.tf +++ b/ecs/host_group/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/network/README.md b/ecs/network/README.md index a9e1e2f1..3771c5bd 100644 --- a/ecs/network/README.md +++ b/ecs/network/README.md @@ -16,7 +16,7 @@ Creates networking resources needed for a standard ECS cluster setup: | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | | [null](#requirement\_null) | >= 2.1.2 | | [tls](#requirement\_tls) | >= 2.0.1 | diff --git a/ecs/network/domain/README.md b/ecs/network/domain/README.md index 3d045b6c..15814721 100644 --- a/ecs/network/domain/README.md +++ b/ecs/network/domain/README.md @@ -7,7 +7,7 @@ Creates a Route53 record that points to the cluster load balancer. If `https_lis | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/network/domain/versions.tf b/ecs/network/domain/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/network/domain/versions.tf +++ b/ecs/network/domain/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/network/versions.tf b/ecs/network/versions.tf index ec229921..0fe5be8b 100644 --- a/ecs/network/versions.tf +++ b/ecs/network/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/repository/README.md b/ecs/repository/README.md index bc39a2d4..6114fc87 100644 --- a/ecs/repository/README.md +++ b/ecs/repository/README.md @@ -7,7 +7,7 @@ Creates an ECR repository and a policy for CI which allows push/pull access. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/repository/versions.tf b/ecs/repository/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/repository/versions.tf +++ b/ecs/repository/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/services/statsd/README.md b/ecs/services/statsd/README.md index a3536391..0b1a5c58 100644 --- a/ecs/services/statsd/README.md +++ b/ecs/services/statsd/README.md @@ -7,7 +7,7 @@ Adds a statsd server, using cloudwatch agent, to each ECS instance | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/services/statsd/versions.tf b/ecs/services/statsd/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/services/statsd/versions.tf +++ b/ecs/services/statsd/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/services/web/README.md b/ecs/services/web/README.md index b29ead4b..d04c8faa 100644 --- a/ecs/services/web/README.md +++ b/ecs/services/web/README.md @@ -7,7 +7,7 @@ Creates an ECS service exposed to the internet using an Application Load Balance | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.42.0 | ## Providers diff --git a/ecs/services/web/versions.tf b/ecs/services/web/versions.tf index 60dbec75..5a3b3c89 100644 --- a/ecs/services/web/versions.tf +++ b/ecs/services/web/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.42.0" diff --git a/ecs/services/worker/README.md b/ecs/services/worker/README.md index 83f7ac0d..72bdb577 100644 --- a/ecs/services/worker/README.md +++ b/ecs/services/worker/README.md @@ -7,7 +7,7 @@ Creates an ECS service for background workers | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/services/worker/versions.tf b/ecs/services/worker/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/services/worker/versions.tf +++ b/ecs/services/worker/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/task/README.md b/ecs/task/README.md index 08cf9391..4d4ae3c3 100644 --- a/ecs/task/README.md +++ b/ecs/task/README.md @@ -34,7 +34,7 @@ We recommend creating the task definition using `image` or `image_name` + `image | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/task/container_definition/README.md b/ecs/task/container_definition/README.md index d21969fa..24bad29d 100644 --- a/ecs/task/container_definition/README.md +++ b/ecs/task/container_definition/README.md @@ -7,7 +7,7 @@ Creates a container definition that can be provided to a task definition | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | ## Providers diff --git a/ecs/task/container_definition/versions.tf b/ecs/task/container_definition/versions.tf index fc9886fd..6fcd6d8d 100644 --- a/ecs/task/container_definition/versions.tf +++ b/ecs/task/container_definition/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers {} } diff --git a/ecs/task/log_group/README.md b/ecs/task/log_group/README.md index bd85c074..f7e70341 100644 --- a/ecs/task/log_group/README.md +++ b/ecs/task/log_group/README.md @@ -7,7 +7,7 @@ Creates a CloudWatch log group for a container and outputs container logging con | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ecs/task/log_group/versions.tf b/ecs/task/log_group/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/task/log_group/versions.tf +++ b/ecs/task/log_group/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/task/versions.tf b/ecs/task/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/task/versions.tf +++ b/ecs/task/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ecs/versions.tf b/ecs/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ecs/versions.tf +++ b/ecs/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/elasticache/redis/README.md b/elasticache/redis/README.md index f213d8f7..70d077ca 100644 --- a/elasticache/redis/README.md +++ b/elasticache/redis/README.md @@ -7,7 +7,7 @@ Creates an Elasticache Redis cluster | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/elasticache/redis/versions.tf b/elasticache/redis/versions.tf index db7202fa..c4d2a4f5 100644 --- a/elasticache/redis/versions.tf +++ b/elasticache/redis/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/iam/user/README.md b/iam/user/README.md index 44bf9f47..b9606bdc 100644 --- a/iam/user/README.md +++ b/iam/user/README.md @@ -7,7 +7,7 @@ Creates an IAM user along with an access key and attaches the given policies to | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.50.0 | ## Providers diff --git a/iam/user/set/README.md b/iam/user/set/README.md index 25004089..9cae3daa 100644 --- a/iam/user/set/README.md +++ b/iam/user/set/README.md @@ -7,7 +7,7 @@ Creates a set of IAM users with access keys | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/iam/user/set/versions.tf b/iam/user/set/versions.tf index db7202fa..c4d2a4f5 100644 --- a/iam/user/set/versions.tf +++ b/iam/user/set/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/iam/user/versions.tf b/iam/user/versions.tf index 22997663..cb680edf 100644 --- a/iam/user/versions.tf +++ b/iam/user/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.50.0" diff --git a/lambda/README.md b/lambda/README.md index 87bc602f..72e0bbcb 100644 --- a/lambda/README.md +++ b/lambda/README.md @@ -7,7 +7,7 @@ Creates an AWS Lambda function | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers @@ -66,7 +66,6 @@ Creates an AWS Lambda function |------|-------------| | [arn](#output\_arn) | The ARN identifying the Lambda Function | | [invoke\_arn](#output\_invoke\_arn) | The ARN to be used for invoking Lambda Function from API Gateway | -| [invoke\_script](#output\_invoke\_script) | Shell script for invoking the lambda using AWS CLI.
Expects the event JSON to be passed via `$EVENT` environment variable.
Useful for invoking the lambda during `terraform apply` using `null_resource`. | | [metrics](#output\_metrics) | Cloudwatch monitoring metrics | | [name](#output\_name) | The Lambda Function name | | [qualified\_arn](#output\_qualified\_arn) | The ARN identifying the Lambda Function Version | diff --git a/lambda/bin/invoke b/lambda/bin/invoke new file mode 100755 index 00000000..615ebb4d --- /dev/null +++ b/lambda/bin/invoke @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Wrapper for `aws lambda invoke` which: +# - reads the event from standard input +# - writes the result to standard output +# - prints logs to standard error +# - fails (exit 1) on error +# +# Requires: +# - aws cli +# - jq +# +# Usage: +# lambda/bin/invoke FUNCTION_NAME [options...] RESULT +# +# FUNCTION_NAME can be anything 'aws lambda invoke --function-name' accepts +# options are any additional aws lambda invoke options, eg. --region + +set -e + +log() { + echo >&2 "$@" +} + +function="$1" +shift 1 +event="$(cat)" + +# create a temporary file for the result and make sure it's deleted on exit +result=$(mktemp) +trap "rm -f '$result'" EXIT + +log "Invoking $function with:" +echo "$event" | jq >&2 + +invoke_response=$( + aws lambda invoke \ + --function-name "$function" \ + --payload "$event" \ + --output json \ + --log-type Tail \ + "$@" \ + "$result" +) + +log +log "Invoke response:" +echo "$invoke_response" | jq 'del(.LogResult)' >&2 +log +log "Function log:" +echo "$invoke_response" | jq -r '.LogResult' | base64 -d >&2 +log +log "Function result:" +cat "$result" | jq + +if echo "$invoke_response" | jq -e 'has("FunctionError")' >/dev/null; then + exit 1 +fi diff --git a/lambda/examples/basic/main.tf b/lambda/examples/basic/main.tf index 85d79f31..2356621d 100644 --- a/lambda/examples/basic/main.tf +++ b/lambda/examples/basic/main.tf @@ -66,40 +66,3 @@ module "lambda_environment" { output "lambda_environment" { value = module.lambda_environment } - -# Invoking a lambda using AWS CLI --------------------------------------------- - -module "lambda_invoke" { - source = "./../.." - - name = "terraform-modules-lambda-example-invoke" - - files = { - "index.js" = < [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/lambda/layer/versions.tf b/lambda/layer/versions.tf index db7202fa..c4d2a4f5 100644 --- a/lambda/layer/versions.tf +++ b/lambda/layer/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/lambda/main.tf b/lambda/main.tf index 1ccab834..d12f375a 100644 --- a/lambda/main.tf +++ b/lambda/main.tf @@ -118,32 +118,3 @@ locals { invoke_arn = var.create ? aws_lambda_function.lambda[0].invoke_arn : "" version = var.create ? aws_lambda_function.lambda[0].version : "" } - -locals { - invoke_script = <<-EOT - set -e - - result=$(mktemp) - trap "rm -f '$result'" EXIT - - echo "Invoking lambda ${local.qualified_arn}..." - invoke_error=$( - aws lambda invoke \ - --region '${local.region}' \ - --function-name '${local.qualified_arn}' \ - --payload "$EVENT" \ - --query 'FunctionError' \ - --output text \ - "$result" - ) - - if [ "$invoke_error" = "None" ]; then - echo "Success:" - cat "$result" - else - echo "Error:" - cat "$result" - exit 1 - fi - EOT -} diff --git a/lambda/outputs.tf b/lambda/outputs.tf index 6edb1d46..24cbf4d8 100644 --- a/lambda/outputs.tf +++ b/lambda/outputs.tf @@ -23,15 +23,6 @@ output "version" { value = local.version } -output "invoke_script" { - description = < [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/lambda/trigger/schedule/versions.tf b/lambda/trigger/schedule/versions.tf index db7202fa..c4d2a4f5 100644 --- a/lambda/trigger/schedule/versions.tf +++ b/lambda/trigger/schedule/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/lambda/versions.tf b/lambda/versions.tf index db7202fa..c4d2a4f5 100644 --- a/lambda/versions.tf +++ b/lambda/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/meta/README.md b/meta/README.md index 169fb320..f00d63d2 100644 --- a/meta/README.md +++ b/meta/README.md @@ -33,7 +33,7 @@ terraform output -module NAME_OF_META_MODULE backend_config | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/meta/aws_account/README.md b/meta/aws_account/README.md index 7eb7462d..2676dc1b 100644 --- a/meta/aws_account/README.md +++ b/meta/aws_account/README.md @@ -7,7 +7,7 @@ Creates a sub-account for a given project's, environment's resources. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/meta/aws_account/versions.tf b/meta/aws_account/versions.tf index db7202fa..c4d2a4f5 100644 --- a/meta/aws_account/versions.tf +++ b/meta/aws_account/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/meta/versions.tf b/meta/versions.tf index db7202fa..c4d2a4f5 100644 --- a/meta/versions.tf +++ b/meta/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/rds/postgres/README.md b/rds/postgres/README.md index 9fac51b9..972da080 100644 --- a/rds/postgres/README.md +++ b/rds/postgres/README.md @@ -7,7 +7,7 @@ Creates an RDS PostgreSQL database instance | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | | [random](#requirement\_random) | >= 2.1.2 | @@ -47,7 +47,7 @@ Creates an RDS PostgreSQL database instance | [multi\_az](#input\_multi\_az) | Specifies if the RDS instance is multi-AZ | `bool` | `true` | no | | [password](#input\_password) | Password for the master DB user | `string` | n/a | yes | | [port](#input\_port) | The port on which the DB accepts connections | `number` | `5432` | no | -| [postgres\_version](#input\_postgres\_version) | RDS Postgres engine version | `string` | `"10.13"` | no | +| [postgres\_version](#input\_postgres\_version) | RDS Postgres engine version | `string` | `"10.15"` | no | | [prevent\_destroy](#input\_prevent\_destroy) | Should the DB be protected from accidental deletion | `bool` | `true` | no | | [project](#input\_project) | Kebab-cased project name | `string` | n/a | yes | | [public](#input\_public) | Should the DB be publicly accessible, will have no effect if placed in a private subnet | `bool` | `false` | no | diff --git a/rds/postgres/example/bin/psql_invoke b/rds/postgres/example/bin/psql_invoke new file mode 100755 index 00000000..5a6ef411 --- /dev/null +++ b/rds/postgres/example/bin/psql_invoke @@ -0,0 +1,7 @@ +#!/bin/sh + +lambda_invoke="$(dirname "$0")/../../../../lambda/bin/invoke" + +echo "$EVENT" | "$lambda_invoke" \ + terraform-modules-postgres-example-db-management \ + --region eu-west-1 diff --git a/rds/postgres/example/main.tf b/rds/postgres/example/main.tf index 4505a0d7..97a98057 100644 --- a/rds/postgres/example/main.tf +++ b/rds/postgres/example/main.tf @@ -57,7 +57,8 @@ locals { } resource "null_resource" "environment_db_user" { - for_each = local.environments + depends_on = [module.db] + for_each = local.environments triggers = { name = "terraform_modules_${each.key}" @@ -65,7 +66,7 @@ resource "null_resource" "environment_db_user" { provisioner "local-exec" { when = create - command = module.db.management_lambda.invoke_script + command = "${path.module}/bin/psql_invoke" environment = { EVENT = jsonencode({ queries = [ "CREATE ROLE ${self.triggers.name} WITH LOGIN", @@ -76,7 +77,7 @@ resource "null_resource" "environment_db_user" { provisioner "local-exec" { when = destroy - command = module.db.management_lambda.invoke_script + command = "${path.module}/bin/psql_invoke" environment = { EVENT = jsonencode({ queries = ["DROP ROLE ${self.triggers.name}"] }) } @@ -91,7 +92,8 @@ resource "random_password" "environment_db_password" { } resource "null_resource" "environment_db_password" { - for_each = local.environments + depends_on = [module.db] + for_each = local.environments triggers = { name = null_resource.environment_db_user[each.key].triggers.name @@ -100,17 +102,25 @@ resource "null_resource" "environment_db_password" { provisioner "local-exec" { when = create - command = module.db.management_lambda.invoke_script - environment = { EVENT = jsonencode({ - queries = [ - "ALTER ROLE ${self.triggers.name} WITH PASSWORD '${self.triggers.password}'" - ] - }) } + command = <<-EOT + ${path.module}/bin/psql_invoke 2>&1 \ + | sed "s/$SENSITIVE_PATTERN/(sensitive)/" + EOT + + environment = { + SENSITIVE_PATTERN = self.triggers.password + EVENT = jsonencode({ + queries = [ + "ALTER ROLE ${self.triggers.name} WITH PASSWORD '${self.triggers.password}'" + ] + }) + } } } resource "null_resource" "environment_db" { - for_each = local.environments + depends_on = [module.db] + for_each = local.environments triggers = { name = null_resource.environment_db_user[each.key].triggers.name @@ -119,7 +129,7 @@ resource "null_resource" "environment_db" { provisioner "local-exec" { when = create - command = module.db.management_lambda.invoke_script + command = "${path.module}/bin/psql_invoke" environment = { EVENT = jsonencode({ queries = [ "CREATE DATABASE ${self.triggers.name} OWNER ${self.triggers.owner}" @@ -129,7 +139,7 @@ resource "null_resource" "environment_db" { provisioner "local-exec" { when = destroy - command = module.db.management_lambda.invoke_script + command = "${path.module}/bin/psql_invoke" environment = { EVENT = jsonencode({ queries = ["DROP DATABASE ${self.triggers.name}"] }) } diff --git a/rds/postgres/management_lambda/README.md b/rds/postgres/management_lambda/README.md index 597ba714..d97ef44a 100644 --- a/rds/postgres/management_lambda/README.md +++ b/rds/postgres/management_lambda/README.md @@ -20,7 +20,7 @@ Remember to always run `npm run build` before committing any changes in `src`, s | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers @@ -58,7 +58,6 @@ Remember to always run `npm run build` before committing any changes in `src`, s | Name | Description | |------|-------------| | [arn](#output\_arn) | The ARN identifying the Lambda Function | -| [invoke\_script](#output\_invoke\_script) | Shell script for invoking the lambda using AWS CLI.
Expects the event JSON to be passed via `$EVENT` environment variable.
Useful for invoking the lambda during `terraform apply` using `null_resource`. | | [name](#output\_name) | The Lambda Function name | | [qualified\_arn](#output\_qualified\_arn) | The ARN identifying the Lambda Function Version | | [security\_group\_id](#output\_security\_group\_id) | Security group id | diff --git a/rds/postgres/management_lambda/outputs.tf b/rds/postgres/management_lambda/outputs.tf index 7affc15d..6093e051 100644 --- a/rds/postgres/management_lambda/outputs.tf +++ b/rds/postgres/management_lambda/outputs.tf @@ -17,12 +17,3 @@ output "security_group_id" { description = "Security group id" value = var.create ? aws_security_group.lambda[0].id : "" } - -output "invoke_script" { - description = < [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/redirect/versions.tf b/redirect/versions.tf index db7202fa..c4d2a4f5 100644 --- a/redirect/versions.tf +++ b/redirect/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ses/domain/README.md b/ses/domain/README.md index e9e987d0..6e0cafb4 100644 --- a/ses/domain/README.md +++ b/ses/domain/README.md @@ -18,7 +18,7 @@ Registers a domain with AWS SES and verifies it | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/ses/domain/versions.tf b/ses/domain/versions.tf index db7202fa..c4d2a4f5 100644 --- a/ses/domain/versions.tf +++ b/ses/domain/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/spa/README.md b/spa/README.md index 15559f74..bcfce29c 100644 --- a/spa/README.md +++ b/spa/README.md @@ -20,7 +20,7 @@ Module creates: | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/spa/ci/README.md b/spa/ci/README.md index 268623c9..e7a7e362 100644 --- a/spa/ci/README.md +++ b/spa/ci/README.md @@ -11,7 +11,7 @@ Creates an AWS user for CI/CD pipelines which can update the contents of the giv | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/spa/ci/versions.tf b/spa/ci/versions.tf index db7202fa..c4d2a4f5 100644 --- a/spa/ci/versions.tf +++ b/spa/ci/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/spa/middleware/README.md b/spa/middleware/README.md index 895c49cc..a82a540c 100644 --- a/spa/middleware/README.md +++ b/spa/middleware/README.md @@ -7,7 +7,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [archive](#requirement\_archive) | >= 1.2.2 | | [aws](#requirement\_aws) | >= 2.40.0 | diff --git a/spa/middleware/versions.tf b/spa/middleware/versions.tf index 9893f494..a92b1d57 100644 --- a/spa/middleware/versions.tf +++ b/spa/middleware/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/spa/middleware_common/README.md b/spa/middleware_common/README.md index 7231f83f..85e654a2 100644 --- a/spa/middleware_common/README.md +++ b/spa/middleware_common/README.md @@ -7,7 +7,7 @@ | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/spa/middleware_common/versions.tf b/spa/middleware_common/versions.tf index db7202fa..c4d2a4f5 100644 --- a/spa/middleware_common/versions.tf +++ b/spa/middleware_common/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/spa/versions.tf b/spa/versions.tf index db7202fa..c4d2a4f5 100644 --- a/spa/versions.tf +++ b/spa/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/ssl/acm/README.md b/ssl/acm/README.md index 0302d316..8dd8e1f1 100644 --- a/ssl/acm/README.md +++ b/ssl/acm/README.md @@ -7,7 +7,7 @@ Creates an SSL certificate using AWS ACM, verifies domain ownership using Route5 | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 3.0.0 | ## Providers diff --git a/ssl/acm/versions.tf b/ssl/acm/versions.tf index 17bfda8d..f64fca7c 100644 --- a/ssl/acm/versions.tf +++ b/ssl/acm/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 3.0.0" diff --git a/terraform/backend/s3/README.md b/terraform/backend/s3/README.md index 036a7fcb..1a9c0268 100644 --- a/terraform/backend/s3/README.md +++ b/terraform/backend/s3/README.md @@ -7,7 +7,7 @@ Creates resources needed to use a terraform S3 backend with locking | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [aws](#requirement\_aws) | >= 2.40.0 | ## Providers diff --git a/terraform/backend/s3/versions.tf b/terraform/backend/s3/versions.tf index db7202fa..c4d2a4f5 100644 --- a/terraform/backend/s3/versions.tf +++ b/terraform/backend/s3/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { aws = ">= 2.40.0" diff --git a/tools/bin/check-all-docs b/tools/bin/check-all-docs new file mode 100755 index 00000000..b5a647dd --- /dev/null +++ b/tools/bin/check-all-docs @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check if module documentations are up to date +# +# Usage: +# tools/bin/check-all-docs + +set -e + +tools_bin=$(dirname "$0") + +"$tools_bin/find-modules" | parallel --keep-order "$tools_bin/check-docs '{}/README.md'" diff --git a/tools/bin/check-docs b/tools/bin/check-docs index eddc31dd..36be02a3 100755 --- a/tools/bin/check-docs +++ b/tools/bin/check-docs @@ -7,6 +7,7 @@ set -e +root_dir=$(realpath --relative-to="$PWD" "$(dirname "$0")/../..") module_dir=$(dirname $1) actual=$1 expected=$1.expected @@ -23,16 +24,18 @@ fi cp $actual $expected terraform-docs \ - --config .terraform-docs.yml \ + --config "$root_dir/.terraform-docs.yml" \ --output-file "$(realpath --relative-to="$module_dir" "$expected")" \ "$module_dir" if diff -q "$actual" "$expected" >/dev/null; then - echo "$actual docs are up to date" + echo "✅ $actual docs are up to date" exit 0 else - echo "$actual docs are outdated, diff:" - echo - diff -u "$expected" "$actual" + echo "❌ $actual docs are outdated" + + [ -n "$CI" ] && echo "::group::$module_dir diff" + diff -u "$expected" "$actual" || true + [ -n "$CI" ] && echo '::endgroup::' exit 1 fi diff --git a/tools/bin/find-examples b/tools/bin/find-examples index 22e489e0..9da5a709 100755 --- a/tools/bin/find-examples +++ b/tools/bin/find-examples @@ -1,6 +1,8 @@ #!/bin/bash -find . \ +root_dir=$(realpath --relative-to="$PWD" "$(dirname "$0")/../..") + +find "$root_dir" \ -name '*.tf' \ -exec dirname '{}' \; \ | sort -u \ diff --git a/tools/bin/find-modules b/tools/bin/find-modules index 898fd617..1313d464 100755 --- a/tools/bin/find-modules +++ b/tools/bin/find-modules @@ -1,6 +1,8 @@ #!/bin/bash -find . \ +root_dir=$(realpath --relative-to="$PWD" "$(dirname "$0")/../..") + +find "$root_dir" \ -name variables.tf \ -not -path './.*' \ -o -name outputs.tf \ diff --git a/tools/bin/update-docs b/tools/bin/update-docs index da2a5230..1baead4a 100755 --- a/tools/bin/update-docs +++ b/tools/bin/update-docs @@ -10,8 +10,9 @@ set -e +root_dir=$(realpath --relative-to="$PWD" "$(dirname "$0")/../..") module_dir=$(dirname $1) terraform-docs \ - --config .terraform-docs.yml \ + --config "$root_dir/.terraform-docs.yml" \ "$module_dir" diff --git a/tools/bin/validate-all-examples b/tools/bin/validate-all-examples new file mode 100755 index 00000000..9ff72a42 --- /dev/null +++ b/tools/bin/validate-all-examples @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +tools_bin=$(dirname "$0") + +"$tools_bin/find-examples" | parallel --keep-order "$tools_bin/validate-module '{}'" diff --git a/tools/bin/validate-all-modules b/tools/bin/validate-all-modules new file mode 100755 index 00000000..b37d6758 --- /dev/null +++ b/tools/bin/validate-all-modules @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +tools_bin=$(dirname "$0") + +"$tools_bin/find-modules" | parallel --keep-order "$tools_bin/validate-module '{}'" diff --git a/tools/bin/validate-module b/tools/bin/validate-module new file mode 100755 index 00000000..77a63645 --- /dev/null +++ b/tools/bin/validate-module @@ -0,0 +1,24 @@ +#!/bin/bash + +module_dir="$1" + +validate() { + set -e + + cd "$module_dir" + terraform init -backend=false + terraform validate +} + +validate_out=$(validate 2>&1) +validate_exit_code=$? + +if [ $validate_exit_code -eq 0 ]; then + echo "✅ $module_dir" +else + echo "❌ $module_dir" + [ -n "$CI" ] && echo "::group::$module_dir output" + echo "$validate_out" + [ -n "$CI" ] && echo "::endgroup::" + exit $validate_exit_code +fi diff --git a/versions.tf b/versions.tf index 9bb2b214..f7543e6c 100644 --- a/versions.tf +++ b/versions.tf @@ -1,6 +1,6 @@ # Used in CI to download plugins once terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" # Make sure all providers needed by any module are listed required_providers { diff --git a/zip/README.md b/zip/README.md index a812aa2b..d2660cc3 100644 --- a/zip/README.md +++ b/zip/README.md @@ -7,7 +7,7 @@ Creates a zip archive with the specified contents. | Name | Version | |------|---------| -| [terraform](#requirement\_terraform) | >= 0.12, <0.13 | +| [terraform](#requirement\_terraform) | >= 0.12, <0.14 | | [archive](#requirement\_archive) | >= 2.0 | ## Providers diff --git a/zip/versions.tf b/zip/versions.tf index 80a7b7e6..aec71732 100644 --- a/zip/versions.tf +++ b/zip/versions.tf @@ -1,5 +1,5 @@ terraform { - required_version = ">= 0.12, <0.13" + required_version = ">= 0.12, <0.14" required_providers { archive = ">= 2.0"