From 341a24ce5bd0889aa0d0ca5b5f5ce3b2a14e4c7e Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Sun, 25 Jul 2021 23:47:25 +0100 Subject: [PATCH 1/2] feat: add support for Terraform v1.x --- CHANGELOG.md | 4 ++ Makefile | 49 +++++++++++++------ README.md | 4 +- examples/README.md | 2 +- examples/complete/README.md | 2 +- .../user-pool-with-default-settings/README.md | 2 +- test/README.md | 2 +- versions.tf | 2 +- 8 files changed, 45 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c848fb..fe46616 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Add support for Terraform `v1.x` + ## [0.6.0] ### Added diff --git a/Makefile b/Makefile index 703ab83..844923b 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,10 @@ # Set default shell to bash SHELL := /bin/bash -o pipefail -BUILD_TOOLS_VERSION ?= v0.11.0 +BUILD_TOOLS_VERSION ?= v0.12.0 BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION} -# # Some CI providers such as GitHub Actions, CircleCI, and TravisCI are setting # the CI environment variable to a non-empty value by default to indicate that # the current workflow is running in a Continuous Integration environment. @@ -18,36 +17,51 @@ BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION} # https://www.gnu.org/software/automake/manual/html_node/Debugging-Make-Rules.html # ifdef CI - TF_IN_AUTOMATION ?= yes - export TF_IN_AUTOMATION + TF_IN_AUTOMATION ?= yes + export TF_IN_AUTOMATION - V ?= 1 + V ?= 1 endif ifndef NOCOLOR - GREEN := $(shell tput -Txterm setaf 2) - YELLOW := $(shell tput -Txterm setaf 3) - WHITE := $(shell tput -Txterm setaf 7) - RESET := $(shell tput -Txterm sgr0) + GREEN := $(shell tput -Txterm setaf 2) + YELLOW := $(shell tput -Txterm setaf 3) + WHITE := $(shell tput -Txterm setaf 7) + RESET := $(shell tput -Txterm sgr0) endif GIT_TOPLEVEl = $(shell git rev-parse --show-toplevel) +# Generic docker run flags DOCKER_RUN_FLAGS += -v ${GIT_TOPLEVEl}:/build DOCKER_RUN_FLAGS += --rm DOCKER_RUN_FLAGS += -e TF_IN_AUTOMATION +# If SSH_AUTH_SOCK is set, we forward the SSH agent of the host system into +# the docker container. This is useful when working with private repositories +# and dependencies that might need to be cloned inside the container (e.g. +# private Terraform modules). ifdef SSH_AUTH_SOCK DOCKER_SSH_FLAGS += -e SSH_AUTH_SOCK=/ssh-agent DOCKER_SSH_FLAGS += -v ${SSH_AUTH_SOCK}:/ssh-agent endif -DOCKER_AWS_FLAGS += -e AWS_ACCESS_KEY_ID -DOCKER_AWS_FLAGS += -e AWS_SECRET_ACCESS_KEY -DOCKER_AWS_FLAGS += -e AWS_SESSION_TOKEN +# If AWS_ACCESS_KEY_ID is defined, we are likely running inside an AWS provider +# module. To enable AWS authentication inside the docker container, we inject +# the relevant environment variables. +ifdef AWS_ACCESS_KEY_ID + DOCKER_AWS_FLAGS += -e AWS_ACCESS_KEY_ID + DOCKER_AWS_FLAGS += -e AWS_SECRET_ACCESS_KEY + DOCKER_AWS_FLAGS += -e AWS_SESSION_TOKEN +endif -DOCKER_FLAGS += ${DOCKER_RUN_FLAGS} -DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE} +# If GITHUB_OWNER is defined, we are likely running inside a GitHub provider +# module. To enable GitHub authentication inside the docker container, +# we inject the relevant environment variables. +ifdef GITHUB_OWNER + DOCKER_GITHUB_FLAGS += -e GITHUB_TOKEN + DOCKER_GITHUB_FLAGS += -e GITHUB_OWNER +endif .PHONY: default default: help @@ -67,7 +81,9 @@ test/pre-commit: ## Run all Go tests inside a build-tools docker container. This is complementary to running 'go test ./test/...'. .PHONY: test/unit-tests test/unit-tests: DOCKER_FLAGS += ${DOCKER_SSH_FLAGS} +test/unit-tests: DOCKER_FLAGS += ${DOCKER_GITHUB_FLAGS} test/unit-tests: DOCKER_FLAGS += ${DOCKER_AWS_FLAGS} +test/unit-tests: DOCKER_FLAGS += -e TF_DATA_DIR=.terratest test/unit-tests: TEST ?= "TestUnit" test/unit-tests: @echo "${YELLOW}[TEST] ${GREEN}Start Running Go Tests in Docker Container.${RESET}" @@ -96,7 +112,10 @@ help: } \ { lastLine = $$0 }' $(MAKEFILE_LIST) -# define helper functions +# Define helper functions +DOCKER_FLAGS += ${DOCKER_RUN_FLAGS} +DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE} + quiet-command = $(if ${V},${1},$(if ${2},@echo ${2} && ${1}, @${1})) docker-run = $(call quiet-command,${DOCKER_RUN_CMD} ${1} | cat,"${YELLOW}[DOCKER RUN] ${GREEN}${1}${RESET}") go-test = $(call quiet-command,${DOCKER_RUN_CMD} go test -v -count 1 -timeout 45m -parallel 128 ${1} | cat,"${YELLOW}[TEST] ${GREEN}${1}${RESET}") diff --git a/README.md b/README.md index 6202bff..cca176c 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A [Terraform] module for deploying and managing [Cognito User Pools] on [Amazon Web Services (AWS)][AWS]. -*This module supports Terraform v0.15, v0.14, v0.13 as well as v0.12.20 and above +*This module supports Terraform v1.x, v0.15, v0.14, v0.13 as well as v0.12.20 and above and is compatible with the terraform AWS provider v3.19 and above.* The last version supporting terraform AWS provider v2.x is v0.4.1. @@ -589,7 +589,7 @@ Copyright © 2020 [Mineiros GmbH][homepage] [badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-cognito-user-pool.svg?label=latest&sort=semver [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform [badge-slack]: https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack [build-status]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/actions diff --git a/examples/README.md b/examples/README.md index 790c55c..345e933 100644 --- a/examples/README.md +++ b/examples/README.md @@ -17,7 +17,7 @@ [homepage]: https://mineiros.io/?ref=terraform-aws-cognito-user-pool [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform [badge-slack]: https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack [badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-cognito-user-pool.svg?label=latest&sort=semver diff --git a/examples/complete/README.md b/examples/complete/README.md index 7d11808..856a629 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -145,7 +145,7 @@ Run `terraform destroy` to destroy all resources again. [homepage]: https://mineiros.io/?ref=terraform-module-template [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform [badge-slack]: https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack [releases-terraform]: https://github.com/hashicorp/terraform/releases diff --git a/examples/user-pool-with-default-settings/README.md b/examples/user-pool-with-default-settings/README.md index 36ba904..a9be2a4 100644 --- a/examples/user-pool-with-default-settings/README.md +++ b/examples/user-pool-with-default-settings/README.md @@ -53,7 +53,7 @@ Run `terraform destroy` to destroy all resources again. [homepage]: https://mineiros.io/?ref=terraform-module-template [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform [badge-slack]: https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack [releases-terraform]: https://github.com/hashicorp/terraform/releases diff --git a/test/README.md b/test/README.md index 1ab3d2f..91036fa 100644 --- a/test/README.md +++ b/test/README.md @@ -74,7 +74,7 @@ Alternatively, you can also run the tests without Docker. [Go]: https://golang.org/ [Terraform]: https://www.terraform.io/downloads.html [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform [badge-slack]: https://img.shields.io/badge/slack-@mineiros--community-f32752.svg?logo=slack [releases-terraform]: https://github.com/hashicorp/terraform/releases diff --git a/versions.tf b/versions.tf index 910bbad..39b24cc 100644 --- a/versions.tf +++ b/versions.tf @@ -3,7 +3,7 @@ # ------------------------------------------------------------------------------ terraform { - required_version = ">= 0.12.20, < 0.16" + required_version = ">= 0.12.20, < 2.0" required_providers { aws = ">= 3.19, < 4.0" From 23810ed3a7f77d2cf6577d294146b2829d7566a0 Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Sun, 25 Jul 2021 23:58:21 +0100 Subject: [PATCH 2/2] chore: prepare v0.7.0 release --- CHANGELOG.md | 7 +++++-- README.md | 2 +- examples/complete/README.md | 2 +- examples/complete/main.tf | 2 +- examples/user-pool-with-default-settings/README.md | 2 +- examples/user-pool-with-default-settings/main.tf | 2 +- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe46616..ae4c7da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.7.0] + ### Added - Add support for Terraform `v1.x` @@ -121,11 +123,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -[unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.1...HEAD -[0.5.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...v0.5.1 +[unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.7.0...HEAD +[0.7.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.6.0...v0.7.0 +[0.6.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...v0.6.0 [0.5.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.1...v0.5.0 [0.4.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.0...v0.4.1 [0.4.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.3.0...v0.4.0 diff --git a/README.md b/README.md index cca176c..95c8e75 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ Most basic usage just setting required arguments: ```hcl module "terraform-aws-cognito-user-pool" { source = "mineiros-io/cognito-user-pool/aws" - version = "~> 0.6.0" + version = "~> 0.7.0" name = "application-userpool" } diff --git a/examples/complete/README.md b/examples/complete/README.md index 856a629..8269922 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -12,7 +12,7 @@ shows how to deploy a Cognito User Pool with custom settings. ```hcl module "cognito_user_pool" { source = "mineiros-io/cognito-user-pool/aws" - version = "~> 0.6.0" + version = "~> 0.7.0" name = "complete-example-userpool" diff --git a/examples/complete/main.tf b/examples/complete/main.tf index f6dd9f2..ca1d0af 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -17,7 +17,7 @@ provider "aws" { module "cognito_user_pool" { source = "mineiros-io/cognito-user-pool/aws" - version = "~> 0.6.0" + version = "~> 0.7.0" name = "complete-example-userpool" diff --git a/examples/user-pool-with-default-settings/README.md b/examples/user-pool-with-default-settings/README.md index a9be2a4..82cbcf8 100644 --- a/examples/user-pool-with-default-settings/README.md +++ b/examples/user-pool-with-default-settings/README.md @@ -13,7 +13,7 @@ defined in the [variables.tf] file of this module. ```hcl module "cognito_user_pool" { source = "mineiros-io/cognito-user-pool/aws" - version = "~> 0.6.0" + version = "~> 0.7.0" name = "example-userpool" } diff --git a/examples/user-pool-with-default-settings/main.tf b/examples/user-pool-with-default-settings/main.tf index 5ee6927..5846abf 100644 --- a/examples/user-pool-with-default-settings/main.tf +++ b/examples/user-pool-with-default-settings/main.tf @@ -18,7 +18,7 @@ provider "aws" { module "cognito_user_pool" { source = "mineiros-io/cognito-user-pool/aws" - version = "~> 0.6.0" + version = "~> 0.7.0" name = "example-userpool" }