Skip to content

Commit

Permalink
Merge pull request #36 from mineiros-io/soerenmartius/add-terraform-0…
Browse files Browse the repository at this point in the history
…-15-support

feat: add support for Terraform v0.15
  • Loading branch information
soerenmartius authored May 20, 2021
2 parents f8b338e + 422d11e commit 9918b23
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 31 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
name: CI/CD Pipeline

on: push
on:
push:
branches:
- master
pull_request:
branches:
- master

env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINEIROS_TESTING_AWS_SECRET_ACCESS_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
repos:
- repo: https://github.com/mineiros-io/pre-commit-hooks
rev: v0.1.3
rev: v0.2.3
hooks:
- id: terraform-fmt
- id: terraform-validate
exclude: ^examples|.terraform/
- id: tflint
- id: gofmt
- id: goimports
- id: golint
- id: golangci-lint
- id: phony-targets
- id: markdown-link-check
14 changes: 12 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.6.0]
### Added
- feat: feat: add support for Terraform `v0.15`

### Changed
- feat: upgrade terratest to `v1.34.0`
- build: upgrade build-tools to `v0.11.0`
- build: upgrade pre-commit-hooks to `v0.2.3`

## [0.5.0]
### Added
- Add support for `account_recovery_mechanisms`
Expand Down Expand Up @@ -80,9 +89,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add unit tests for basic use cases.

<!-- markdown-link-check-disable -->
[Unreleased]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.5.0...HEAD
[0.5.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.4.1...v0.5.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
<!-- markdown-link-check-enable -->
[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
[0.3.0]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/compare/v0.2.0...v0.3.0
Expand Down
33 changes: 23 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Set default shell to bash
SHELL := /bin/bash -o pipefail

BUILD_TOOLS_VERSION ?= v0.7.0
BUILD_TOOLS_VERSION ?= v0.11.0
BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools
BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION}

# If running in CI
# If running in CI (e.g. GitHub Actions)
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
#
# to disable TF_IN_AUTOMATION in CI set it to empty
# To disable TF_IN_AUTOMATION in CI set it to empty
# https://www.terraform.io/docs/commands/environment-variables.html#tf_in_automation
#
# we are using GNU style quiet commands to disable set V to non-empty e.g. V=1
# We are using GNU style quiet commands to disable set V to non-empty e.g. V=1
# https://www.gnu.org/software/automake/manual/html_node/Debugging-Make-Rules.html
#
ifdef CI
Expand All @@ -27,10 +28,15 @@ ifndef NOCOLOR
RESET := $(shell tput -Txterm sgr0)
endif

# We are creating docker volumes for /go and /terraform that are unique per
# repository to reuse dependencies between different docker run commands.
VOLUME_PREFIX ?= mineiros_build_tools
VOLUME_SUFFIX ?= $(notdir $(shell git rev-parse --show-toplevel || "build"))
DOCKER_RUN_FLAGS += -v ${VOLUME_PREFIX}-terraform-${VOLUME_SUFFIX}:/terraform
DOCKER_RUN_FLAGS += -v ${VOLUME_PREFIX}-go-${VOLUME_SUFFIX}:/go
DOCKER_RUN_FLAGS += -v ${PWD}:/build
DOCKER_RUN_FLAGS += --rm
DOCKER_RUN_FLAGS += -v ${PWD}:/app/src
DOCKER_RUN_FLAGS += -e TF_IN_AUTOMATION
DOCKER_RUN_FLAGS += -e USER_UID=$(shell id -u)

DOCKER_SSH_FLAGS += -e SSH_AUTH_SOCK=/ssh-agent
DOCKER_SSH_FLAGS += -v ${SSH_AUTH_SOCK}:/ssh-agent
Expand All @@ -45,7 +51,13 @@ DOCKER_RUN_CMD = docker run ${DOCKER_FLAGS} ${BUILD_TOOLS_DOCKER_IMAGE}
.PHONY: default
default: help

## Run pre-commit hooks in build-tools docker container.
# Not exposed as a callable target by `make help`, since this is a one-time shot to simplify the development of this module.
.PHONY: template/adjust
template/adjust: FILTER = -path ./.git -prune -a -type f -o -type f -not -name Makefile
template/adjust:
@find . $(FILTER) -exec sed -i -e "s,terraform-module-template,$${PWD##*/},g" {} \;

## Run pre-commit hooks inside a build-tools docker container.
.PHONY: test/pre-commit
test/pre-commit: DOCKER_FLAGS += ${DOCKER_SSH_FLAGS}
test/pre-commit:
Expand All @@ -55,17 +67,18 @@ test/pre-commit:
.PHONY: test/unit-tests
test/unit-tests: DOCKER_FLAGS += ${DOCKER_SSH_FLAGS}
test/unit-tests: DOCKER_FLAGS += ${DOCKER_AWS_FLAGS}
test/unit-tests: TEST ?= "TestUnit"
test/unit-tests:
@echo "${YELLOW}[TEST] ${GREEN}Start Running Go Tests in Docker Container.${RESET}"
$(call go-test,./test/...)
$(call go-test,./test -run $(TEST))

## Clean up cache and temporary files
.PHONY: clean
clean:
$(call rm-command,.terraform)
$(call rm-command,*.tfplan)
$(call rm-command,examples/*/.terraform)
$(call rm-command,examples/*/*.tfplan)
$(call rm-command,*/*/.terraform)
$(call rm-command,*/*/*.tfplan)

## Display help for all targets
.PHONY: help
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.14, v0.13 as well as v0.12.20 and above
*This module supports Terraform 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.
Expand Down Expand Up @@ -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.5.0"
version = "~> 0.6.0"
name = "application-userpool"
}
Expand Down Expand Up @@ -589,7 +589,7 @@ Copyright &copy; 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.14%20|%200.13%20|%200.12.20+-623CE4.svg?logo=terraform
[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-slack]: https://img.shields.io/badge/[email protected]?logo=slack

[build-status]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/actions
Expand Down
4 changes: 0 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@
- [user-pool-with-default-settings/] Deploy a Cognito User Pool with custom settings.

<!-- References -->
<!-- markdown-link-check-disable -->
[complete/]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/blob/master/examples/complete
[user-pool-with-default-settings/]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/blob/master/examples/user-pool-with-default-settings
<!-- markdown-link-check-enable -->

[homepage]: https://mineiros.io/?ref=terraform-aws-cognito-user-pool

Expand All @@ -23,9 +21,7 @@
[badge-slack]: https://img.shields.io/badge/[email protected]?logo=slack
[badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-cognito-user-pool.svg?label=latest&sort=semver

<!-- markdown-link-check-disable -->
[releases-github]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/releases
<!-- markdown-link-check-enable -->
[releases-terraform]: https://github.com/hashicorp/terraform/releases
[apache20]: https://opensource.org/licenses/Apache-2.0
[slack]: https://join.slack.com/t/mineiros-community/shared_invite/zt-ehidestg-aLGoIENLVs6tvwJ11w9WGg
4 changes: 1 addition & 3 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.0"
version = "~> 0.6.0"
name = "complete-example-userpool"
Expand Down Expand Up @@ -140,9 +140,7 @@ Run `terraform destroy` to destroy all resources again.

<!-- References -->

<!-- markdown-link-check-disable -->
[main.tf]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/tree/master/examples/complete/main.tf
<!-- markdown-link-check-enable -->

[homepage]: https://mineiros.io/?ref=terraform-module-template

Expand Down
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ provider "aws" {

module "cognito_user_pool" {
source = "mineiros-io/cognito-user-pool/aws"
version = "~> 0.5.0"
version = "~> 0.6.0"

name = "complete-example-userpool"

Expand Down
4 changes: 1 addition & 3 deletions examples/user-pool-with-default-settings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.0"
version = "~> 0.6.0"
name = "example-userpool"
}
Expand Down Expand Up @@ -47,10 +47,8 @@ Run `terraform destroy` to destroy all resources again.

<!-- References -->

<!-- markdown-link-check-disable -->
[main.tf]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/tree/master/examples/user-pool-with-default-settings/main.tf
[variables.tf]: https://github.com/mineiros-io/terraform-aws-cognito-user-pool/tree/master/variables.tf
<!-- markdown-link-check-enable -->

[homepage]: https://mineiros.io/?ref=terraform-module-template

Expand Down
2 changes: 1 addition & 1 deletion examples/user-pool-with-default-settings/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ provider "aws" {

module "cognito_user_pool" {
source = "mineiros-io/cognito-user-pool/aws"
version = "~> 0.5.0"
version = "~> 0.6.0"

name = "example-userpool"
}
6 changes: 5 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# ------------------------------------------------------------------------------
# SET TERRAFORM AND PROVIDER REQUIREMENTS FOR RUNNING THIS MODULE
# ------------------------------------------------------------------------------

terraform {
required_version = ">= 0.12.20, < 0.15"
required_version = ">= 0.12.20, < 0.16"

required_providers {
aws = ">= 3.19, < 4.0"
Expand Down

0 comments on commit 9918b23

Please sign in to comment.