Skip to content

Commit d532ea7

Browse files
Merge pull request #43 from mineiros-io/soerenmartius/terraform-1.x-support
Add support for Terraform v1.x
2 parents c5086ef + 23810ed commit d532ea7

File tree

10 files changed

+55
-29
lines changed

10 files changed

+55
-29
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.7.0]
11+
12+
### Added
13+
14+
- Add support for Terraform `v1.x`
15+
1016
## [0.6.0]
1117

1218
### Added
@@ -117,11 +123,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
117123

118124
<!-- markdown-link-check-disable -->
119125

120-
[unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.1...HEAD
121-
[0.5.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...v0.5.1
126+
[unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.7.0...HEAD
127+
[0.7.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.6.0...v0.7.0
122128

123129
<!-- markdown-link-check-enable -->
124130

131+
[0.6.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...v0.6.0
125132
[0.5.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.1...v0.5.0
126133
[0.4.1]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.0...v0.4.1
127134
[0.4.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.3.0...v0.4.0

Makefile

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Set default shell to bash
22
SHELL := /bin/bash -o pipefail
33

4-
BUILD_TOOLS_VERSION ?= v0.11.0
4+
BUILD_TOOLS_VERSION ?= v0.12.0
55
BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools
66
BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION}
77

8-
#
98
# Some CI providers such as GitHub Actions, CircleCI, and TravisCI are setting
109
# the CI environment variable to a non-empty value by default to indicate that
1110
# 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}
1817
# https://www.gnu.org/software/automake/manual/html_node/Debugging-Make-Rules.html
1918
#
2019
ifdef CI
21-
TF_IN_AUTOMATION ?= yes
22-
export TF_IN_AUTOMATION
20+
TF_IN_AUTOMATION ?= yes
21+
export TF_IN_AUTOMATION
2322

24-
V ?= 1
23+
V ?= 1
2524
endif
2625

2726
ifndef NOCOLOR
28-
GREEN := $(shell tput -Txterm setaf 2)
29-
YELLOW := $(shell tput -Txterm setaf 3)
30-
WHITE := $(shell tput -Txterm setaf 7)
31-
RESET := $(shell tput -Txterm sgr0)
27+
GREEN := $(shell tput -Txterm setaf 2)
28+
YELLOW := $(shell tput -Txterm setaf 3)
29+
WHITE := $(shell tput -Txterm setaf 7)
30+
RESET := $(shell tput -Txterm sgr0)
3231
endif
3332

3433
GIT_TOPLEVEl = $(shell git rev-parse --show-toplevel)
3534

35+
# Generic docker run flags
3636
DOCKER_RUN_FLAGS += -v ${GIT_TOPLEVEl}:/build
3737
DOCKER_RUN_FLAGS += --rm
3838
DOCKER_RUN_FLAGS += -e TF_IN_AUTOMATION
3939

40+
# If SSH_AUTH_SOCK is set, we forward the SSH agent of the host system into
41+
# the docker container. This is useful when working with private repositories
42+
# and dependencies that might need to be cloned inside the container (e.g.
43+
# private Terraform modules).
4044
ifdef SSH_AUTH_SOCK
4145
DOCKER_SSH_FLAGS += -e SSH_AUTH_SOCK=/ssh-agent
4246
DOCKER_SSH_FLAGS += -v ${SSH_AUTH_SOCK}:/ssh-agent
4347
endif
4448

45-
DOCKER_AWS_FLAGS += -e AWS_ACCESS_KEY_ID
46-
DOCKER_AWS_FLAGS += -e AWS_SECRET_ACCESS_KEY
47-
DOCKER_AWS_FLAGS += -e AWS_SESSION_TOKEN
49+
# If AWS_ACCESS_KEY_ID is defined, we are likely running inside an AWS provider
50+
# module. To enable AWS authentication inside the docker container, we inject
51+
# the relevant environment variables.
52+
ifdef AWS_ACCESS_KEY_ID
53+
DOCKER_AWS_FLAGS += -e AWS_ACCESS_KEY_ID
54+
DOCKER_AWS_FLAGS += -e AWS_SECRET_ACCESS_KEY
55+
DOCKER_AWS_FLAGS += -e AWS_SESSION_TOKEN
56+
endif
4857

49-
DOCKER_FLAGS += ${DOCKER_RUN_FLAGS}
50-
DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}
58+
# If GITHUB_OWNER is defined, we are likely running inside a GitHub provider
59+
# module. To enable GitHub authentication inside the docker container,
60+
# we inject the relevant environment variables.
61+
ifdef GITHUB_OWNER
62+
DOCKER_GITHUB_FLAGS += -e GITHUB_TOKEN
63+
DOCKER_GITHUB_FLAGS += -e GITHUB_OWNER
64+
endif
5165

5266
.PHONY: default
5367
default: help
@@ -67,7 +81,9 @@ test/pre-commit:
6781
## Run all Go tests inside a build-tools docker container. This is complementary to running 'go test ./test/...'.
6882
.PHONY: test/unit-tests
6983
test/unit-tests: DOCKER_FLAGS += ${DOCKER_SSH_FLAGS}
84+
test/unit-tests: DOCKER_FLAGS += ${DOCKER_GITHUB_FLAGS}
7085
test/unit-tests: DOCKER_FLAGS += ${DOCKER_AWS_FLAGS}
86+
test/unit-tests: DOCKER_FLAGS += -e TF_DATA_DIR=.terratest
7187
test/unit-tests: TEST ?= "TestUnit"
7288
test/unit-tests:
7389
@echo "${YELLOW}[TEST] ${GREEN}Start Running Go Tests in Docker Container.${RESET}"
@@ -96,7 +112,10 @@ help:
96112
} \
97113
{ lastLine = $$0 }' $(MAKEFILE_LIST)
98114

99-
# define helper functions
115+
# Define helper functions
116+
DOCKER_FLAGS += ${DOCKER_RUN_FLAGS}
117+
DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}
118+
100119
quiet-command = $(if ${V},${1},$(if ${2},@echo ${2} && ${1}, @${1}))
101120
docker-run = $(call quiet-command,${DOCKER_RUN_CMD} ${1} | cat,"${YELLOW}[DOCKER RUN] ${GREEN}${1}${RESET}")
102121
go-test = $(call quiet-command,${DOCKER_RUN_CMD} go test -v -count 1 -timeout 45m -parallel 128 ${1} | cat,"${YELLOW}[TEST] ${GREEN}${1}${RESET}")

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A [Terraform] module for deploying and managing
1212
[Cognito User Pools]
1313
on [Amazon Web Services (AWS)][AWS].
1414

15-
*This module supports Terraform v0.15, v0.14, v0.13 as well as v0.12.20 and above
15+
*This module supports Terraform v1.x, v0.15, v0.14, v0.13 as well as v0.12.20 and above
1616
and is compatible with the terraform AWS provider v3.19 and above.*
1717

1818
The last version supporting terraform AWS provider v2.x is v0.4.1.
@@ -67,7 +67,7 @@ Most basic usage just setting required arguments:
6767
```hcl
6868
module "terraform-aws-cognito-user-pool" {
6969
source = "mineiros-io/cognito-user-pool/aws"
70-
version = "~> 0.6.0"
70+
version = "~> 0.7.0"
7171
7272
name = "application-userpool"
7373
}
@@ -589,7 +589,7 @@ Copyright &copy; 2020 [Mineiros GmbH][homepage]
589589

590590
[badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-cognito-user-pool.svg?label=latest&sort=semver
591591
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
592-
[badge-terraform]: https://img.shields.io/badge/terraform-0.15%20|%200.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform
592+
[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
593593
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
594594

595595
[build-status]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/actions

examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
[homepage]: https://mineiros.io/?ref=terraform-aws-cognito-user-pool
1818

1919
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
20-
[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform
20+
[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
2121
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
2222
[badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-cognito-user-pool.svg?label=latest&sort=semver
2323

examples/complete/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ shows how to deploy a Cognito User Pool with custom settings.
1212
```hcl
1313
module "cognito_user_pool" {
1414
source = "mineiros-io/cognito-user-pool/aws"
15-
version = "~> 0.6.0"
15+
version = "~> 0.7.0"
1616
1717
name = "complete-example-userpool"
1818
@@ -145,7 +145,7 @@ Run `terraform destroy` to destroy all resources again.
145145
[homepage]: https://mineiros.io/?ref=terraform-module-template
146146

147147
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
148-
[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform
148+
[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
149149
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
150150

151151
[releases-terraform]: https://github.com/hashicorp/terraform/releases

examples/complete/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ provider "aws" {
1717

1818
module "cognito_user_pool" {
1919
source = "mineiros-io/cognito-user-pool/aws"
20-
version = "~> 0.6.0"
20+
version = "~> 0.7.0"
2121

2222
name = "complete-example-userpool"
2323

examples/user-pool-with-default-settings/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ defined in the [variables.tf] file of this module.
1313
```hcl
1414
module "cognito_user_pool" {
1515
source = "mineiros-io/cognito-user-pool/aws"
16-
version = "~> 0.6.0"
16+
version = "~> 0.7.0"
1717
1818
name = "example-userpool"
1919
}
@@ -53,7 +53,7 @@ Run `terraform destroy` to destroy all resources again.
5353
[homepage]: https://mineiros.io/?ref=terraform-module-template
5454

5555
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
56-
[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform
56+
[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
5757
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
5858

5959
[releases-terraform]: https://github.com/hashicorp/terraform/releases

examples/user-pool-with-default-settings/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ provider "aws" {
1818

1919
module "cognito_user_pool" {
2020
source = "mineiros-io/cognito-user-pool/aws"
21-
version = "~> 0.6.0"
21+
version = "~> 0.7.0"
2222

2323
name = "example-userpool"
2424
}

test/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Alternatively, you can also run the tests without Docker.
7474
[Go]: https://golang.org/
7575
[Terraform]: https://www.terraform.io/downloads.html
7676
[badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg
77-
[badge-terraform]: https://img.shields.io/badge/terraform-0.13%20and%200.12.20+-623CE4.svg?logo=terraform
77+
[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
7878
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
7979

8080
[releases-terraform]: https://github.com/hashicorp/terraform/releases

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# ------------------------------------------------------------------------------
44

55
terraform {
6-
required_version = ">= 0.12.20, < 0.16"
6+
required_version = ">= 0.12.20, < 2.0"
77

88
required_providers {
99
aws = ">= 3.19, < 4.0"

0 commit comments

Comments
 (0)