Skip to content

Commit 85b241c

Browse files
committed
Init
0 parents  commit 85b241c

33 files changed

+3223
-0
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See GitHub's docs for more information on this file:
2+
# https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/configuration-options-for-dependency-updates
3+
version: 2
4+
updates:
5+
- package-ecosystem: "github-actions"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
- package-ecosystem: "gomod"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"

.github/workflows/ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
paths-ignore:
5+
- 'README.md'
6+
branches:
7+
- master
8+
- main
9+
push:
10+
branches:
11+
- master
12+
- main
13+
paths-ignore:
14+
- 'README.md'
15+
schedule:
16+
# NOTE: Run every day at 00:00, since we're using a remote API (TFE) not managed by us.
17+
- cron: '0 0 * * *'
18+
jobs:
19+
build:
20+
name: Build
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 5
23+
steps:
24+
- name: Set up Go
25+
uses: actions/[email protected]
26+
with:
27+
go-version: '1.16'
28+
id: go
29+
- name: Check out code into the Go module directory
30+
uses: actions/[email protected]
31+
- name: Get dependencies
32+
run: |
33+
go mod download
34+
- name: Build
35+
run: |
36+
go build -v .
37+
- name: Download golangci-lint
38+
run: |
39+
curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.37.1
40+
- name: Lint
41+
run: |
42+
go run mage.go -v lint
43+
44+
test:
45+
name: Matrix Test
46+
needs: build
47+
runs-on: ubuntu-latest
48+
timeout-minutes: 15
49+
strategy:
50+
fail-fast: false
51+
matrix:
52+
terraform:
53+
- '0.12.29'
54+
- '0.13.4'
55+
- '0.14.0-beta2'
56+
- '0.14.7'
57+
steps:
58+
- name: Set up Go
59+
uses: actions/[email protected]
60+
with:
61+
go-version: 1.16
62+
id: go
63+
- name: Check out code into the Go module directory
64+
uses: actions/[email protected]
65+
- name: Get dependencies
66+
run: |
67+
go mod download
68+
- name: TF acceptance tests
69+
timeout-minutes: 10
70+
env:
71+
TF_ACC: "1"
72+
TF_ACC_TERRAFORM_VERSION: ${{ matrix.terraform }}
73+
TFE_TOKEN: ${{ secrets.TFE_TOKEN }}
74+
TFE_TEST_WORKSPACE_ID: ${{ secrets.TFE_TEST_WORKSPACE_ID }}
75+
run: |
76+
go run mage.go test

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
jobs:
7+
goreleaser:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Unshallow
13+
run: git fetch --prune --unshallow
14+
- name: Set up Go
15+
uses: actions/setup-go@v2
16+
with:
17+
go-version: 1.16
18+
- name: Import GPG key
19+
id: import_gpg
20+
# TODO: move this to HashiCorp namespace or find alternative that is just simple gpg commands
21+
# see https://github.com/hashicorp/terraform-provider-scaffolding/issues/22
22+
uses: paultyng/[email protected]
23+
env:
24+
# These secrets will need to be configured for the repository:
25+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
26+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@v2
29+
with:
30+
version: latest
31+
args: release --rm-dist
32+
env:
33+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
34+
# GitHub sets this automatically
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
*.dll
2+
*.exe
3+
.DS_Store
4+
example.tf
5+
terraform.tfplan
6+
terraform.tfstate
7+
bin/
8+
dist/
9+
modules-dev/
10+
/pkg/
11+
website/.vagrant
12+
website/.bundle
13+
website/build
14+
website/node_modules
15+
.vagrant/
16+
*.backup
17+
./*.tfstate
18+
.terraform/
19+
*.log
20+
*.bak
21+
*~
22+
.*.swp
23+
.idea
24+
*.iml
25+
*.test
26+
*.iml
27+
28+
website/vendor
29+
30+
# Test exclusions
31+
!command/test-fixtures/**/*.tfstate
32+
!command/test-fixtures/**/.terraform/
33+
34+
# Keep windows files with windows line endings
35+
*.winfile eol=crlf
36+
37+
# Local terraform to test the provider manually and play
38+
playground/
39+
/terraform-provider-vaulted-tfe
40+
/terraform-provider-vaulted-tfe.exe

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.16.2

.golangci.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
run:
2+
tests: false
3+
# NOTE: Verify `go.{mod,sum}` is up-to-date by attempting to download dependencies
4+
# if anything is missing
5+
modules-download-mode: readonly
6+
7+
output:
8+
format: colored-line-number
9+
print-issued-lines: true
10+
print-linter-name: true
11+
12+
linters-settings:
13+
goheader:
14+
template: |-
15+
Copyright 2021 SumUp Ltd.
16+
Licensed under the Apache License, Version 2.0 (the "License");
17+
you may not use this file except in compliance with the License.
18+
You may obtain a copy of the License at
19+
http://www.apache.org/licenses/LICENSE-2.0
20+
Unless required by applicable law or agreed to in writing, software
21+
distributed under the License is distributed on an "AS IS" BASIS,
22+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23+
See the License for the specific language governing permissions and
24+
limitations under the License.
25+
errcheck:
26+
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
27+
# default is false: such cases aren't reported by default.
28+
check-type-assertions: false
29+
30+
# print linter name in the end of issue text, default is true
31+
govet:
32+
check-shadowing: true
33+
maligned:
34+
suggest-new: true
35+
dupl:
36+
threshold: 100
37+
goconst:
38+
min-len: 2
39+
min-occurrences: 2
40+
gocognit:
41+
min-complexity: 55
42+
depguard:
43+
list-type: blacklist
44+
packages:
45+
# logging is allowed only by logutils.Log, logrus
46+
# is allowed to use only in logutils package
47+
- github.com/sirupsen/logrus
48+
# NOTE: Be very, very wary not to use GPL3 software as library
49+
- github.com/golangci/golangci-lint
50+
# NOTE: Not used, but mistakenly approved by tooling such as editors and IDEs.
51+
- github.com/pkg/errors
52+
misspell:
53+
locale: US
54+
lll:
55+
line-length: 140
56+
goimports:
57+
local-prefixes: github.com/sumup-oss/terraform-provider-vaulted-tfe
58+
gocritic:
59+
enabled-tags:
60+
- performance
61+
cyclop:
62+
# NOTE: Too-low cyclomatic complexity value
63+
# results into worse code design and readability.
64+
max-complexity: 25
65+
66+
linters:
67+
enable-all: true
68+
disable:
69+
# NOTE: "effective" golang style is full of arguable practices.
70+
# We don't need that and besides gofmt does the required minimum of style modifications.
71+
- golint
72+
# NOTE: Too much false positives
73+
- unparam
74+
# NOTE: It's a great linter, but gets in the way too often by not being customizable.
75+
- gochecknoglobals
76+
# NOTE: Full of false positives.
77+
- interfacer
78+
# NOTE: Function length is not an offense.
79+
- funlen
80+
# TODO: Fix false positives
81+
- gomnd
82+
# NOTE: "Packages names should not use underscores" is not a good practice while mixed caps is also disallowed.
83+
- stylecheck
84+
# NOTE: Too verbose
85+
- exhaustivestruct
86+
# NOTE: Worse readability
87+
- nlreturn
88+
# NOTE: False-positives
89+
- nestif
90+
issues:
91+
exclude-rules:
92+
- text: "don't use an underscore in package name"
93+
linters:
94+
- revive
95+
- text: "weak cryptographic primitive"
96+
linters:
97+
- gosec
98+
- path: _test\.go
99+
linters:
100+
- gocyclo
101+
- errcheck
102+
- dupl
103+
- gosec

.goreleaser.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
6+
- go mod tidy
7+
builds:
8+
- env:
9+
# goreleaser does not work with CGO, it could also complicate
10+
# usage by users in CI/CD systems like Terraform Cloud where
11+
# they are unable to install libraries.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
18+
goos:
19+
- freebsd
20+
- windows
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- '386'
26+
- arm
27+
- arm64
28+
ignore:
29+
- goos: darwin
30+
goarch: '386'
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
32+
archives:
33+
- format: zip
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
35+
checksum:
36+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
37+
algorithm: sha256
38+
signs:
39+
- artifacts: checksum
40+
args:
41+
# if you are using this in a GitHub action or some other automated pipeline, you
42+
# need to pass the batch flag to indicate its not interactive.
43+
- "--batch"
44+
- "--local-user"
45+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
46+
- "--output"
47+
- "${signature}"
48+
- "--detach-sign"
49+
- "${artifact}"
50+
release:
51+
# If you want to manually examine the release before its live, uncomment this line:
52+
# draft: true
53+
changelog:
54+
skip: true

.terraform-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
0.14.6

CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Version History
2+
3+
## Intro
4+
5+
The version history is motivated by https://semver.org/ and https://keepachangelog.com/en/1.0.0/ .
6+
7+
NOTE: This project went from non-standard versioning to semver at some point.
8+
9+
## Structure
10+
11+
Types of changes that can be seen in the changelog
12+
13+
```
14+
Added: for new features/functionality.
15+
Changed: for changes in existing features/functionality.
16+
Deprecated: for soon-to-be removed features. Removed in the
17+
Removed: for now removed features.
18+
Fixed: for any bug fixes.
19+
Security: in case of vulnerabilities.
20+
```
21+
22+
## How deprecation of functionality is handled?
23+
24+
tl;dr 1 minor release stating that the functionality is going to be deprecated. Then in the next major - removed.
25+
26+
```
27+
Deprecating existing functionality is a normal part of software development and
28+
is often required to make forward progress.
29+
30+
When you deprecate part of your public API, you should do two things:
31+
32+
(1) update your documentation to let users know about the change,
33+
(2) issue a new minor release with the deprecation in place.
34+
Before you completely remove the functionality in a new major
35+
release there should be at least one minor release
36+
that contains the deprecation so that users can smoothly transition to the new API
37+
```
38+
39+
As per https://semver.org/ .
40+
41+
As per rule-of-thumb, moving the project forward is very important,
42+
but providing stability is the most important thing to anyone using `vaulted`.
43+
44+
Introducing breaking changes under a feature flag can be ok in some cases where new functionality needs user feedback before being introduced in next major release.
45+
46+
## Changelog
47+
48+
Change line format:
49+
50+
```
51+
* <Change title/PR title/content> ; Ref: <pr link>
52+
```
53+
54+
## Unreleased (master)
55+
56+
## v0.1.0
57+
58+
### Added
59+
60+
* Project
61+
* CI setup
62+
* Documentation

CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @syndbg

0 commit comments

Comments
 (0)