Skip to content

Commit a64a312

Browse files
committed
Initial commit
Most of the content is inspired by existing content in https://github.com/hashicorp/terraform-provider-scaffolding.
0 parents  commit a64a312

28 files changed

+1955
-0
lines changed

.github/CODE_OF_CONDUCT.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Code of Conduct
2+
3+
HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code.
4+
5+
Please read the full text at https://www.hashicorp.com/community-guidelines

.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# See GitHub's documentation for more information on this file:
2+
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/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/release.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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+
# Default values to simplify job configurations below.
17+
env:
18+
# Go language version to use for building. This value should also be updated
19+
# in the testing workflow if changed.
20+
GO_VERSION: '1.17'
21+
22+
jobs:
23+
goreleaser:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v2
27+
with:
28+
# Allow goreleaser to access older tag information.
29+
fetch-depth: 0
30+
- uses: actions/setup-go@v2
31+
with:
32+
go-version: ${{ env.GO_VERSION }}
33+
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
34+
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
35+
# secret. If you would rather own your own GPG handling, please fork this action
36+
# or use an alternative one for key handling.
37+
- name: Import GPG key
38+
id: import_gpg
39+
uses: hashicorp/[email protected]
40+
env:
41+
# These secrets will need to be configured for the repository:
42+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
43+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
44+
- name: Run GoReleaser
45+
uses: goreleaser/[email protected]
46+
with:
47+
args: release --rm-dist
48+
env:
49+
# GitHub sets the GITHUB_TOKEN secret automatically.
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/test.yml

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
# Default values to simplify job configurations below.
19+
env:
20+
# Go language version to use for building. This value should also be updated
21+
# in the release workflow if changed.
22+
GO_VERSION: '1.17'
23+
24+
jobs:
25+
# Ensure project builds before running testing matrix
26+
build:
27+
name: Build
28+
runs-on: ubuntu-latest
29+
timeout-minutes: 5
30+
steps:
31+
- uses: actions/setup-go@v2
32+
with:
33+
go-version: ${{ env.GO_VERSION }}
34+
- uses: actions/checkout@v2
35+
- run: go mod download
36+
- run: go build -v .
37+
38+
# Run acceptance tests in a matrix with Terraform CLI versions
39+
test:
40+
name: Terraform Provider Acceptance Tests
41+
needs: build
42+
runs-on: ubuntu-latest
43+
timeout-minutes: 15
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
# list whatever Terraform versions here you would like to support
48+
terraform:
49+
- '1.0.*'
50+
steps:
51+
- uses: actions/setup-go@v2
52+
with:
53+
go-version: ${{ env.GO_VERSION }}
54+
- uses: hashicorp/setup-terraform@v1
55+
with:
56+
go-version: ${{ matrix.terraform }}
57+
- uses: actions/checkout@v2
58+
- run: go mod download
59+
- env:
60+
TF_ACC: "1"
61+
run: go test -v -cover ./internal/provider/
62+
timeout-minutes: 10

.gitignore

+35
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

.goreleaser.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
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+
extra_files:
37+
- glob: 'terraform-registry-manifest.json'
38+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
39+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
40+
algorithm: sha256
41+
signs:
42+
- artifacts: checksum
43+
args:
44+
# if you are using this in a GitHub action or some other automated pipeline, you
45+
# need to pass the batch flag to indicate its not interactive.
46+
- "--batch"
47+
- "--local-user"
48+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
49+
- "--output"
50+
- "${signature}"
51+
- "--detach-sign"
52+
- "${artifact}"
53+
release:
54+
extra_files:
55+
- glob: 'terraform-registry-manifest.json'
56+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
57+
# If you want to manually examine the release before its live, uncomment this line:
58+
# draft: true
59+
changelog:
60+
skip: true

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## 0.1.0 (Unreleased)
2+
3+
FEATURES:

GNUmakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
default: testacc
2+
3+
# Run acceptance tests
4+
.PHONY: testacc
5+
testacc:
6+
TF_ACC=1 go test ./... -v $(TESTARGS) -timeout 120m

0 commit comments

Comments
 (0)