Skip to content

Commit

Permalink
Merge pull request #57 from mineiros-io/soerenmartius/refactor
Browse files Browse the repository at this point in the history
Upgrade tests from template
  • Loading branch information
soerenmartius authored Nov 9, 2021
2 parents 5879667 + 985e154 commit 66cb8b1
Show file tree
Hide file tree
Showing 20 changed files with 1,350 additions and 379 deletions.
61 changes: 61 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# ----------------------------------------------------------------------------------------------------------------------
# GOLANG LINTER RULES
# ----------------------------------------------------------------------------------------------------------------------

# configure golangci-lint
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
issues:
exclude-rules:
- path: _test\.go
linters:
- dupl
- gosec
- goconst
linters:
enable:
- bodyclose
- deadcode
- depguard
- dupl
- errcheck
- gocritic
- gofmt
- goconst
- goimports
- gosec
- gosimple
- revive
- govet
- ineffassign
- interfacer
- misspell
- nakedret
- prealloc
- staticcheck
- structcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace

linters-settings:
errcheck:
# report about assignment of errors to blank identifier: `num, _ := strcnv.Atoi(numStr)`;
# default is false: such cases aren't reported by default.
check-blank: true
ignore: fmt:.*,[rR]ead|[wW]rite|[cC]lose,io:Copy
govet:
# report about shadowed variables
check-shadowing: true
gocyclo:
# minimal code complexity to report, 30 by default
min-complexity: 15
maligned:
# print struct with more effective memory layout or not, false by default
suggest-new: true
gofmt:
# simplify code: gofmt with `-s` option, true by default
simplify: true
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
repos:
- repo: https://github.com/mineiros-io/pre-commit-hooks
rev: v0.2.3
rev: v0.3.0
hooks:
- id: terraform-fmt
- id: terraform-validate
exclude: ^examples|.terraform/
- id: tflint
- id: gofmt
- id: goimports
- id: golangci-lint
- id: phony-targets
- id: markdown-link-check
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Add support for `module_tags`

## [0.9.0]

### BREAKING
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Set default shell to bash
SHELL := /bin/bash -o pipefail

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

Expand Down Expand Up @@ -36,6 +36,10 @@ GIT_TOPLEVEl = $(shell git rev-parse --show-toplevel)
DOCKER_RUN_FLAGS += -v ${GIT_TOPLEVEl}:/build
DOCKER_RUN_FLAGS += --rm
DOCKER_RUN_FLAGS += -e TF_IN_AUTOMATION
# If TF_VERSION is defined, TFSwitch will switch to the desired version on
# container startup. If TF_VERSION is omitted, the default version installed
# inside the docker image will be used.
DOCKER_RUN_FLAGS += -e TF_VERSION

# 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
Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,35 @@ for details and use-cases.

#### Module Configuration

- **`module_enabled`**: *(Optional `bool`)*
- **`module_enabled`**: _(Optional `bool`)_

Specifies whether resources in the module will be created.
Default is `true`.

- **`module_depends_on`**: *(Optional `list(any)`)*
- **`module_tags`**: _(Optional `map(string)`)_

A list of dependencies. Any object can be _assigned_ to this list to define a
hidden external dependency. Default is `[]`.
A map of tags that will be applied to all created resources that accept tags. Tags defined with 'module_tags' can be
overwritten by resource-specific tags.
Default is `{}`.

Example:
```hcl
module_tags = {
environment = "staging"
team = "platform"
}
```

- **`module_depends_on`**: _(Optional `list(dependencies)`)_

A list of dependencies. Any object can be _assigned_ to this list to define a hidden external dependency.

Example:
```hcl
module_depends_on = [
aws_vpc.vpc
]
```

#### Cognito User Pool

Expand Down
30 changes: 27 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
module github.com/mineiros/terraform-aws-cognito-user-pool
module github.com/mineiros-io/terraform-aws-cognito-user-pool

go 1.14
go 1.17

require github.com/gruntwork-io/terratest v0.30.0
require (
github.com/gruntwork-io/terratest v0.38.2
github.com/stretchr/testify v1.7.0
)

require (
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/hcl/v2 v2.9.1 // indirect
github.com/hashicorp/terraform-json v0.12.0 // indirect
github.com/jinzhu/copier v0.0.0-20190924061706-b57f9002281a // indirect
github.com/mattn/go-zglob v0.0.2-0.20190814121620-e3c945676326 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/tmccombs/hcl2json v0.3.3 // indirect
github.com/zclconf/go-cty v1.8.1 // indirect
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
golang.org/x/net v0.0.0-20210614182718-04defd469f4e // indirect
golang.org/x/sys v0.0.0-20210603125802-9665404d3644 // indirect
golang.org/x/text v0.3.6 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Loading

0 comments on commit 66cb8b1

Please sign in to comment.