From 87ac58c625774b9dd8e1ddb90ae7b154587a5f6f Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Mon, 26 Jul 2021 10:47:38 +0100 Subject: [PATCH 1/6] feat: upgrade terratest to v0.37.0 --- go.mod | 2 +- go.sum | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3b7aaea..bbf12bb 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,6 @@ module github.com/mineiros-io/terraform-module-route53 go 1.14 require ( - github.com/gruntwork-io/terratest v0.34.0 + github.com/gruntwork-io/terratest v0.37.0 github.com/stretchr/testify v1.6.0 ) diff --git a/go.sum b/go.sum index a203198..6a2ed01 100644 --- a/go.sum +++ b/go.sum @@ -71,6 +71,7 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.16.26/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.27.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= +github.com/aws/aws-sdk-go v1.38.28/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -218,6 +219,8 @@ github.com/gruntwork-io/terratest v0.30.0 h1:1USVQG4Rg7Fp5WLuTjgU6kt+o7GM0ZcllYc github.com/gruntwork-io/terratest v0.30.0/go.mod h1:7dNmTD2zDKUEVqfmvcUU5c9mZi+986mcXNzhzqPYPg8= github.com/gruntwork-io/terratest v0.34.0 h1:zlDNwYHkjCavF2NWawbEdwEaUJnkyqXCI3P5B0Z3mdM= github.com/gruntwork-io/terratest v0.34.0/go.mod h1:IBb+b5b7p34oZLfpz/ZADyn8TSKeWSBu+vQMmNeePLE= +github.com/gruntwork-io/terratest v0.37.0 h1:sID4/hCjcF5vmjXiU0y71bMQVO458ylYFZk/mxDBTxo= +github.com/gruntwork-io/terratest v0.37.0/go.mod h1:3zzDkmFBGDcSwQRaXS/LKnobwnff09oo5z/B6SVwRy8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= @@ -231,6 +234,8 @@ github.com/hashicorp/hcl/v2 v2.8.2 h1:wmFle3D1vu0okesm8BTLVDyJ6/OL9DCLUwn0b2Opti github.com/hashicorp/hcl/v2 v2.8.2/go.mod h1:bQTN5mpo+jewjJgh8jr0JUguIi7qPHUF6yIfAEN3jqY= github.com/hashicorp/terraform-json v0.9.0 h1:WE7+Wt93W93feOiCligElSyS0tlDzwZUtJuDGIBr8zg= github.com/hashicorp/terraform-json v0.9.0/go.mod h1:3defM4kkMfttwiE7VakJDwCd4R+umhSQnvJwORXbprE= +github.com/hashicorp/terraform-json v0.12.0 h1:8czPgEEWWPROStjkWPUnTQDXmpmZPlkQAwYYLETaTvw= +github.com/hashicorp/terraform-json v0.12.0/go.mod h1:pmbq9o4EuL43db5+0ogX10Yofv1nozM+wskr/bGFJpI= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= @@ -239,6 +244,8 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a h1:zPPuIq2jAWWPTrGt70eK/BSch+gFAGrNzecsoENgu2o= github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a/go.mod h1:yL958EeXv8Ylng6IfnvG4oflryUi3vgA3xPs9hmII1s= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52CupLJyoVwB10FQ/IQlF1pdL8= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -277,10 +284,12 @@ github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326/go.mod h1:9fxibJc github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2/go.mod h1:eD9eIE7cdwcMi9rYluz88Jz2VyhSmden33/aXg4oVIY= github.com/miekg/dns v1.1.31/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= @@ -331,6 +340,7 @@ github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= +github.com/sebdah/goldie v1.0.0/go.mod h1:jXP4hmWywNEwZzhMuv2ccnqTSFpuq8iyQhtQdkkZBH4= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -444,6 +454,8 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974 h1:IX6qOQeG5uLjB/hjjwjedwfjND0hgjPMMyO1RoIXQNI= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b h1:uwuIcX0g4Yl1NC5XAz37xsr2lTtcqevgzYNVt49waME= +golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= From 34dbed30860107de6ffda91733e196d693fdb32c Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Mon, 26 Jul 2021 10:48:06 +0100 Subject: [PATCH 2/6] feat: add support for Terraform v1.x --- CHANGELOG.md | 2 + Makefile | 49 +++++++++++++------ README.md | 4 +- examples/README.md | 2 +- examples/basic-routing/README.md | 5 +- examples/delegation-set/README.md | 2 +- examples/failover-routing/README.md | 2 +- .../README.md | 2 +- .../multiple-domains-same-records/README.md | 2 +- examples/private-hosted-zone/README.md | 2 +- examples/weighted-routing/README.md | 2 +- test/README.md | 2 +- variables.tf | 1 + versions.tf | 2 +- 14 files changed, 49 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6672e1..0647650 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] +- Add support for Terraform `v1.x` + ## [0.5.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 afd3eda..898aa87 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ A [Terraform](https://www.terraform.io) module to create a scalable and highly a [Amazon Route53](https://aws.amazon.com/route53/) Domain Name System (DNS) on [Amazon Web Services (AWS)](https://aws.amazon.com/). -***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 as well as v2.45 and above.*** - [Module Features](#module-features) @@ -308,7 +308,7 @@ Copyright © 2020 [Mineiros GmbH][homepage] [badge-build]: https://mineiros.semaphoreci.com/badges/terraform-aws-route53/branches/master.svg?style=shields [badge-semver]: https://img.shields.io/github/v/tag/mineiros-io/terraform-aws-route53.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,%200.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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-tf-aws]: https://img.shields.io/badge/AWS-3%20and%202.45+-F8991D.svg?logo=terraform diff --git a/examples/README.md b/examples/README.md index 5eb75d7..8cdfa95 100644 --- a/examples/README.md +++ b/examples/README.md @@ -27,7 +27,7 @@ [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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-route53.svg?label=latest&sort=semver diff --git a/examples/basic-routing/README.md b/examples/basic-routing/README.md index 1c5b0b3..46a0d65 100644 --- a/examples/basic-routing/README.md +++ b/examples/basic-routing/README.md @@ -81,13 +81,10 @@ Run `terraform destroy` to destroy all resources again. - [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/basic-routing/main.tf - - [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/delegation-set/README.md b/examples/delegation-set/README.md index baf7eed..f061c08 100644 --- a/examples/delegation-set/README.md +++ b/examples/delegation-set/README.md @@ -59,7 +59,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/delegation-set/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/failover-routing/README.md b/examples/failover-routing/README.md index b0497cd..76c160b 100644 --- a/examples/failover-routing/README.md +++ b/examples/failover-routing/README.md @@ -87,7 +87,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/failover-routing/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/multiple-domains-different-records/README.md b/examples/multiple-domains-different-records/README.md index 740c02f..c66f952 100644 --- a/examples/multiple-domains-different-records/README.md +++ b/examples/multiple-domains-different-records/README.md @@ -93,7 +93,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/multiple-domains-different-records/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/multiple-domains-same-records/README.md b/examples/multiple-domains-same-records/README.md index 95bf328..c51fc8b 100644 --- a/examples/multiple-domains-same-records/README.md +++ b/examples/multiple-domains-same-records/README.md @@ -78,7 +78,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/multiple-domains-same-records/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/private-hosted-zone/README.md b/examples/private-hosted-zone/README.md index ab62332..2a1e2de 100644 --- a/examples/private-hosted-zone/README.md +++ b/examples/private-hosted-zone/README.md @@ -63,7 +63,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/private-hosted-zone/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/examples/weighted-routing/README.md b/examples/weighted-routing/README.md index ebe9c0d..38a5573 100644 --- a/examples/weighted-routing/README.md +++ b/examples/weighted-routing/README.md @@ -76,7 +76,7 @@ Run `terraform destroy` to destroy all resources again. [main.tf]: https://github.com/mineiros-io/terraform-aws-route53/blob/master/examples/weighted-routing/main.tf [homepage]: https://mineiros.io/?ref=terraform-aws-route53 [badge-license]: https://img.shields.io/badge/license-Apache%202.0-brightgreen.svg -[badge-terraform]: https://img.shields.io/badge/terraform-0.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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 [apache20]: https://opensource.org/licenses/Apache-2.0 diff --git a/test/README.md b/test/README.md index 5612d94..90249e0 100644 --- a/test/README.md +++ b/test/README.md @@ -72,7 +72,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.14,%200.13,%200.12.20+-623CE4.svg?logo=terraform +[badge-terraform]: https://img.shields.io/badge/terraform-1.x%20|%200.15%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/variables.tf b/variables.tf index fd132a8..d6a6913 100644 --- a/variables.tf +++ b/variables.tf @@ -160,6 +160,7 @@ variable "zone_id" { # These variables are used to configure the module. # See https://medium.com/mineiros/the-ultimate-guide-on-how-to-write-terraform-modules-part-1-81f86d31f024 # ------------------------------------------------------------------------------ + variable "module_enabled" { type = bool description = "(Optional) Whether to create resources within the module or not. Default is true." diff --git a/versions.tf b/versions.tf index d694ae2..51c2e73 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 = ">= 2.45, < 4.0" From f2aae0bf8c5b9267b638f177dfee63d2fb77c426 Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Mon, 26 Jul 2021 11:35:46 +0100 Subject: [PATCH 3/6] docs: remove example code from README.md's in examples/ --- examples/basic-routing/README.md | 41 --------------- examples/basic-routing/main.tf | 2 +- examples/delegation-set/main.tf | 4 +- examples/failover-routing/README.md | 46 ---------------- examples/failover-routing/main.tf | 2 +- .../README.md | 52 ------------------- .../main.tf | 4 +- .../multiple-domains-same-records/README.md | 38 -------------- .../multiple-domains-same-records/main.tf | 2 +- examples/private-hosted-zone/README.md | 24 --------- examples/private-hosted-zone/main.tf | 2 +- examples/weighted-routing/README.md | 37 ------------- examples/weighted-routing/main.tf | 2 +- 13 files changed, 9 insertions(+), 247 deletions(-) diff --git a/examples/basic-routing/README.md b/examples/basic-routing/README.md index 46a0d65..43ea2a8 100644 --- a/examples/basic-routing/README.md +++ b/examples/basic-routing/README.md @@ -12,47 +12,6 @@ The code in [main.tf] creates a Route53 Zone and Records for the main domain and The `www.` subdomains are implement through CNAMES and point on the A-Records. -```hcl -module "route53" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = "a-dev-mineiros.io" - - records = [ - { - # We don't explicitly need to set names for records that match the zone - type = "A" - alias = { - name = aws_s3_bucket.website.website_endpoint - zone_id = aws_s3_bucket.website.hosted_zone_id - evaluate_target_health = true - } - }, - { - type = "CNAME" - name = "www" - records = [ - "mineiros.io" - ] - }, - { - name = "dev" - type = "A" - ttl = 1800 - records = ["203.0.113.200"] - }, - { - type = "CNAME" - name = "www.dev.mineiros.io" - records = [ - "dev.mineiros.io" - ] - }, - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/basic-routing/main.tf b/examples/basic-routing/main.tf index c3f880f..577c127 100644 --- a/examples/basic-routing/main.tf +++ b/examples/basic-routing/main.tf @@ -73,7 +73,7 @@ resource "aws_s3_bucket_object" "error" { module "route53" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "a-dev-mineiros.io" diff --git a/examples/delegation-set/main.tf b/examples/delegation-set/main.tf index fbdfd22..4ca9cad 100644 --- a/examples/delegation-set/main.tf +++ b/examples/delegation-set/main.tf @@ -25,7 +25,7 @@ provider "aws" { module "route53-zone-with-delegation-set" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.io" } @@ -37,7 +37,7 @@ module "route53-zone-with-delegation-set" { module "route53-zone" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.com" delegation_set_id = module.route53-zone-with-delegation-set.delegation_set.id diff --git a/examples/failover-routing/README.md b/examples/failover-routing/README.md index 76c160b..c96c993 100644 --- a/examples/failover-routing/README.md +++ b/examples/failover-routing/README.md @@ -10,52 +10,6 @@ The code in [main.tf] configures two Route53 Records with associated healthcheck Route53 will route the traffic to the secondary record if the healthcheck of the primary record reports an unhealthy status. -```hcl -resource "aws_route53_health_check" "primary" { - fqdn = "mineiros.io" - port = 80 - type = "HTTP" - resource_path = "/" - failure_threshold = 5 - request_interval = 30 - - tags = { - Name = "mineiros-io-primary-healthcheck" - } -} - -module "route53" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = "mineiros.io" - skip_delegation_set_creation = true - - records = [ - { - type = "A" - set_identifier = "primary" - failover = "PRIMARY" - # Non-alias primary records must have an associated health check - health_check_id = aws_route53_health_check.primary.id - records = [ - "203.0.113.200" - ] - }, - { - type = "A" - set_identifier = "failover" - failover = "SECONDARY" - health_check_id = null - records = [ - "203.0.113.201", - "203.0.113.202" - ] - } - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/failover-routing/main.tf b/examples/failover-routing/main.tf index 06dc3d2..52426bd 100644 --- a/examples/failover-routing/main.tf +++ b/examples/failover-routing/main.tf @@ -37,7 +37,7 @@ resource "aws_route53_health_check" "primary" { module "route53" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.io" skip_delegation_set_creation = true diff --git a/examples/multiple-domains-different-records/README.md b/examples/multiple-domains-different-records/README.md index c66f952..327bb84 100644 --- a/examples/multiple-domains-different-records/README.md +++ b/examples/multiple-domains-different-records/README.md @@ -10,58 +10,6 @@ The code in [main.tf] creates two zones and different records using the convenient `name = []` shortcut. All created zones will share the same delegation set. -```hcl -# Create multiple zones with a single module -module "zones" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = [ - "mineiros.io", - "mineiros.com" - ] -} - -# Create the records for zone a -module "zone_a_records" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - # Wrap the reference to the zone inside a try statement to prevent ugly exceptions if we run terraform destroy - # without running a successful terraform apply before. - zone_id = try(module.zones.zone["mineiros.io"].zone_id, null) - - records = [ - { - type = "TXT" - ttl = 300 - records = [ - "Lorem ipsum" - ] - } - ] -} - -# Create the records for zone b -module "zone_b_records" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - zone_id = try(module.zones.zone["mineiros.com"].zone_id, null) - - records = [ - { - type = "TXT" - ttl = 600 - records = [ - "Lorem ipsum", - "Lorem ipsum dolor sit amet" - ] - } - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/multiple-domains-different-records/main.tf b/examples/multiple-domains-different-records/main.tf index 7db63ce..1b78f66 100644 --- a/examples/multiple-domains-different-records/main.tf +++ b/examples/multiple-domains-different-records/main.tf @@ -16,7 +16,7 @@ provider "aws" { # Create multiple zones with a single module module "zones" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = [ "mineiros.io", @@ -47,7 +47,7 @@ module "zone_a_records" { # Create the records for zone b module "zone_b_records" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" zone_id = try(module.zones.zone["mineiros.com"].zone_id, null) diff --git a/examples/multiple-domains-same-records/README.md b/examples/multiple-domains-same-records/README.md index c51fc8b..d240b59 100644 --- a/examples/multiple-domains-same-records/README.md +++ b/examples/multiple-domains-same-records/README.md @@ -9,44 +9,6 @@ The code in [main.tf] creates two zones and attach the same set of records to both. The zones will share the same delegation set. -```hcl -module "zones" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = [ - "mineiros.io", - "mineiros.com" - ] - - records = [ - { - type = "A" - ttl = 3600 - records = [ - "203.0.113.200", - "203.0.113.201" - ] - }, - { - type = "TXT" - ttl = 300 - records = [ - "Lorem ipsum" - ] - }, - { - name = "testing" - type = "A" - ttl = 3600 - records = [ - "203.0.113.202" - ] - }, - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/multiple-domains-same-records/main.tf b/examples/multiple-domains-same-records/main.tf index 7dec9f5..1794a4d 100644 --- a/examples/multiple-domains-same-records/main.tf +++ b/examples/multiple-domains-same-records/main.tf @@ -14,7 +14,7 @@ provider "aws" { module "zones" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" # Create two zones name = [ diff --git a/examples/private-hosted-zone/README.md b/examples/private-hosted-zone/README.md index 2a1e2de..168d4b0 100644 --- a/examples/private-hosted-zone/README.md +++ b/examples/private-hosted-zone/README.md @@ -8,30 +8,6 @@ The code in [main.tf] creates a private Route53 Zone with a single A-Record. -```hcl -module "route53" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = "mineiros.io" - - vpc_ids = [ - aws_default_vpc.default.id - ] - - records = [ - { - type = "A" - ttl = 3600 - records = [ - "203.0.113.100", - "203.0.113.101", - ] - } - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/private-hosted-zone/main.tf b/examples/private-hosted-zone/main.tf index eb718e2..81c026c 100644 --- a/examples/private-hosted-zone/main.tf +++ b/examples/private-hosted-zone/main.tf @@ -30,7 +30,7 @@ resource "aws_default_vpc" "default" { module "route53" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.io" diff --git a/examples/weighted-routing/README.md b/examples/weighted-routing/README.md index 38a5573..3753abc 100644 --- a/examples/weighted-routing/README.md +++ b/examples/weighted-routing/README.md @@ -8,43 +8,6 @@ The code in [main.tf] creates a Route53 Zone with two attached weighted records. -```hcl -module "route53" { - source = "mineiros-io/route53/aws" - version = "~> 0.5.0" - - name = "mineiros.io" - skip_delegation_set_creation = true - - records = [ - { - type = "A" - set_identifier = "prod" - weight = 90 - records = [ - "203.0.113.0", - "203.0.113.1" - ] - }, - { - type = "A" - set_identifier = "preview" - weight = 10 - records = [ - "216.239.32.117", - ] - }, - { - type = "A" - name = "dev" - records = [ - "203.0.113.3", - ] - } - ] -} -``` - ## Running the example ### Cloning the repository diff --git a/examples/weighted-routing/main.tf b/examples/weighted-routing/main.tf index de1b3fc..3827d38 100644 --- a/examples/weighted-routing/main.tf +++ b/examples/weighted-routing/main.tf @@ -25,7 +25,7 @@ provider "aws" { module "route53" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.io" skip_delegation_set_creation = true From a7b7e465a10eded6c7ccc65567856a51f8c181fb Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Mon, 26 Jul 2021 13:09:30 +0100 Subject: [PATCH 4/6] refactor: wrap outputs in try block and return empty map for delegation_set per default --- outputs.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/outputs.tf b/outputs.tf index ab72305..a6c6061 100644 --- a/outputs.tf +++ b/outputs.tf @@ -8,17 +8,17 @@ output "zone" { description = "The created Hosted Zone(s)." - value = aws_route53_zone.zone + value = try(aws_route53_zone.zone, {}) } output "records" { description = "A list of all created records." - value = aws_route53_record.record + value = try(aws_route53_record.record, {}) } output "delegation_set" { description = "The outputs of the created delegation set." - value = try(aws_route53_delegation_set.delegation_set[0], null) + value = try(aws_route53_delegation_set.delegation_set[0], {}) } # ------------------------------------------------------------------------------ From 16f6e09175e3ee1b04805fc42f629188b7777199 Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Tue, 10 Aug 2021 09:06:45 +0200 Subject: [PATCH 5/6] feat: upgrade disabled test to ensure compatibility with terraform 1.x --- test/unit_disabled_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/unit_disabled_test.go b/test/unit_disabled_test.go index a73e438..b7fbdc2 100644 --- a/test/unit_disabled_test.go +++ b/test/unit_disabled_test.go @@ -18,7 +18,10 @@ func TestUnitDisabled(t *testing.T) { Upgrade: true, } - stdout := terraform.InitAndPlan(t, terraformOptions) + defer terraform.Destroy(t, terraformOptions) + + terraform.InitAndPlan(t, terraformOptions) + stdout := terraform.ApplyAndIdempotent(t, terraformOptions) resourceCount := terraform.GetResourceCount(t, stdout) assert.Equal(t, 0, resourceCount.Add, "No resources should have been created. Found %d instead.", resourceCount.Add) From 54e3093b38a7e728f531a23b3a1540f1c6ee408b Mon Sep 17 00:00:00 2001 From: Soren Martius Date: Mon, 26 Jul 2021 11:36:21 +0100 Subject: [PATCH 6/6] chore: prepare v0.6.0 release --- CHANGELOG.md | 7 +++++-- README.md | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0647650..1a1986c 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.6.0] + - Add support for Terraform `v1.x` ## [0.5.0] @@ -130,11 +132,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 -[unreleased]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.5.0...HEAD -[0.5.0]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.4.0...v0.5.0 +[unreleased]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.6.0...HEAD +[0.6.0]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.5.0...v0.6.0 +[0.5.0]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.4.0...v0.5.0 [0.4.0]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.3.0...v0.4.0 [0.3.0]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.2.3...v0.3.0 [0.2.3]: https://github.com/mineiros-io/terraform-aws-route53/compare/v0.2.2...v0.2.3 diff --git a/README.md b/README.md index 898aa87..1c3dc45 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ a record for `www` pointing to localhost. ```hcl module "route53" { source = "mineiros-io/route53/aws" - version = "~> 0.5.0" + version = "~> 0.6.0" name = "mineiros.io"