Skip to content

Commit 00c2abf

Browse files
committed
Initial commit
0 parents  commit 00c2abf

File tree

18 files changed

+1744
-0
lines changed

18 files changed

+1744
-0
lines changed

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Terraform Provider release workflow.
2+
name: Release
3+
4+
# This GitHub action creates a release when a tag that matches the pattern
5+
# "v*" (e.g. v0.1.0) is created.
6+
on:
7+
push:
8+
tags:
9+
- "v*"
10+
11+
# Releases need permissions to read and write the repository contents.
12+
# GitHub considers creating releases and uploading assets as writing contents.
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
goreleaser:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
# Allow goreleaser to access older tag information.
23+
fetch-depth: 0
24+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
25+
with:
26+
go-version-file: "go.mod"
27+
cache: true
28+
- name: Import GPG key
29+
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
30+
id: import_gpg
31+
with:
32+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
33+
passphrase: ${{ secrets.PASSPHRASE }}
34+
- name: Run GoReleaser
35+
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
36+
with:
37+
args: release --clean
38+
env:
39+
# GitHub sets the GITHUB_TOKEN secret automatically.
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/test.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Terraform Provider testing workflow.
2+
name: Tests
3+
4+
# This GitHub action runs your tests for each pull request and push.
5+
# Optionally, you can turn it on using a schedule for regular testing.
6+
on:
7+
pull_request:
8+
paths-ignore:
9+
- "README.md"
10+
push:
11+
paths-ignore:
12+
- "README.md"
13+
14+
# Testing only needs permissions to read the repository contents.
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
# Ensure project builds before running testing matrix
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 5
24+
steps:
25+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
27+
with:
28+
go-version-file: "go.mod"
29+
cache: true
30+
- run: go mod download
31+
- run: go build -v .
32+
- name: Run linters
33+
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1
34+
with:
35+
version: latest
36+
37+
generate:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
42+
with:
43+
go-version-file: "go.mod"
44+
cache: true
45+
# We need the latest version of Terraform for our documentation generation to use
46+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
47+
with:
48+
terraform_wrapper: false
49+
- run: make generate
50+
- name: git diff
51+
run: |
52+
git diff --compact-summary --exit-code || \
53+
(echo; echo "Unexpected difference in directories after code generation. Run 'make generate' command and commit."; exit 1)
54+
55+
# Run acceptance tests in a matrix with Terraform CLI versions
56+
test:
57+
name: Terraform Provider Acceptance Tests
58+
needs: build
59+
runs-on: ubuntu-latest
60+
timeout-minutes: 15
61+
strategy:
62+
fail-fast: false
63+
matrix:
64+
# list whatever Terraform versions here you would like to support
65+
terraform:
66+
- "1.5.*"
67+
steps:
68+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
69+
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
70+
with:
71+
go-version-file: "go.mod"
72+
cache: true
73+
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
74+
with:
75+
terraform_version: ${{ matrix.terraform }}
76+
terraform_wrapper: false
77+
- run: go mod download
78+
- env:
79+
TF_ACC: "1"
80+
run: go test -v -cover ./internal/provider/
81+
timeout-minutes: 10

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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

.golangci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Visit https://golangci-lint.run/ for usage documentation
2+
# and information on other useful linters
3+
issues:
4+
max-issues-per-linter: 0
5+
max-same-issues: 0
6+
7+
linters:
8+
disable-all: true
9+
enable:
10+
- copyloopvar
11+
- durationcheck
12+
- errcheck
13+
- forcetypeassert
14+
- godot
15+
- gofmt
16+
- gosimple
17+
- govet
18+
- ineffassign
19+
- makezero
20+
- misspell
21+
- nilerr
22+
- predeclared
23+
- staticcheck
24+
- tenv
25+
- unconvert
26+
- unparam
27+
- unused

.goreleaser.yml

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

GNUmakefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
default: fmt lint install generate
2+
3+
build:
4+
go build -v ./...
5+
6+
install: build
7+
go install -v ./...
8+
9+
lint:
10+
golangci-lint run
11+
12+
generate:
13+
cd tools; go generate ./...
14+
15+
fmt:
16+
gofmt -s -w -e .
17+
18+
test:
19+
go test -v -cover -timeout=120s -parallel=10 ./...
20+
21+
testacc:
22+
TF_ACC=1 go test -v -cover -timeout 120m ./...
23+
24+
.PHONY: fmt lint test testacc build install generate

0 commit comments

Comments
 (0)