Skip to content

Commit

Permalink
Merge pull request #45 from mineiros-io/soerenmartius/terraform-v0.14.x
Browse files Browse the repository at this point in the history
feat: add support for Terraform v0.14.x
  • Loading branch information
soerenmartius authored May 5, 2021
2 parents 647be01 + 097d27e commit f79b0b5
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 20 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
name: CI/CD Pipeline

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

env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINEIROS_TESTING_AWS_SECRET_ACCESS_KEY }}
AWS_ACCESS_KEY_ID: ${{ secrets.MINEIROS_TESTING_AWS_ACCESS_KEY_ID }}

jobs:
pre-commit:
Expand Down
2 changes: 2 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ repos:
- id: terraform-validate
exclude: ^examples|.terraform/
- id: tflint
- id: gofmt
- id: goimports
- id: golangci-lint
- id: phony-targets
- id: markdown-link-check
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.4.2]
### Added
- feat: feat: add support for Terraform `v0.14.x`

### Changed
- feat: upgrade terratest to `v1.34.0`
- build: update secrets in GitHub Actions pipeline
- build: upgrade build-tools to `v0.9.0`
- build: upgrade pre-commit-hooks to `v0.2.2`

## [0.4.1]
### Added
- Prepare support for Terraform v0.14.x
Expand Down Expand Up @@ -89,8 +99,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- markdown-link-check-disable -->
[Unreleased]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.4.1...HEAD
[0.4.1]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.4.0...v0.4.1
[0.4.2]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.4.1...v0.4.2
<!-- markdown-link-check-enable -->
[0.4.1]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.2.2...v0.3.0
[0.2.2]: https://github.com/mineiros-io/terraform-aws-s3-bucket/compare/v0.2.1...v0.2.2
Expand Down
31 changes: 17 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
# Set default shell to bash
SHELL := /bin/bash -o pipefail

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

# If running in CI (e.g. GitHub Actions)
# https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
#
# 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.
#
# If TF_IN_AUTOMATION is set to any non-empty value, Terraform adjusts its
# output to avoid suggesting specific commands to run next.
# 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
Expand All @@ -32,9 +29,8 @@ ifndef NOCOLOR
endif

DOCKER_RUN_FLAGS += --rm
DOCKER_RUN_FLAGS += -v ${PWD}:/app/src
DOCKER_RUN_FLAGS += -v ${PWD}:/build
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 @@ -49,27 +45,34 @@ 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:
$(call docker-run,pre-commit run -a)

## Run go tests hooks in build-tools docker container.
## 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_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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ module github.com/mineiros-io/terraform-aws-s3-bucket/v2
go 1.14

require (
github.com/gruntwork-io/terratest v0.30.0
github.com/gruntwork-io/terratest v0.34.0
github.com/stretchr/testify v1.4.0
)
Loading

0 comments on commit f79b0b5

Please sign in to comment.