Skip to content

Commit 010be70

Browse files
dependabot[bot]andyleap
authored andcommitted
Initial commit from template repo
0 parents  commit 010be70

36 files changed

+1975
-0
lines changed

.copywrite.hcl

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template.
2+
schema_version = 1
3+
4+
project {
5+
license = "MPL-2.0"
6+
copyright_year = 2021
7+
8+
header_ignore = [
9+
# examples used within documentation (prose)
10+
"examples/**",
11+
12+
# GitHub issue template configuration
13+
".github/ISSUE_TEMPLATE/*.yml",
14+
15+
# golangci-lint tooling configuration
16+
".golangci.yml",
17+
18+
# GoReleaser tooling configuration
19+
".goreleaser.yml",
20+
]
21+
}

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @hashicorp/terraform-devex

.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

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
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: "gomod"
6+
directory: "/"
7+
schedule:
8+
interval: "daily"
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: "daily"
13+
# TODO: Dependabot only updates hashicorp GHAs in the template repository, the following lines can be removed for consumers of this template
14+
allow:
15+
- dependency-name: "hashicorp/*"
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# DO NOT EDIT - This GitHub Workflow is managed by automation
2+
# https://github.com/hashicorp/terraform-devex-repos
3+
name: Issue Comment Triage
4+
5+
on:
6+
issue_comment:
7+
types: [created]
8+
9+
jobs:
10+
issue_comment_triage:
11+
runs-on: ubuntu-latest
12+
env:
13+
# issue_comment events are triggered by comments on issues and pull requests. Checking the
14+
# value of github.event.issue.pull_request tells us whether the issue is an issue or is
15+
# actually a pull request, allowing us to dynamically set the gh subcommand:
16+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only
17+
COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }}
18+
GH_TOKEN: ${{ github.token }}
19+
steps:
20+
- name: 'Remove waiting-response on comment'
21+
run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response

.github/workflows/lock.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# DO NOT EDIT - This GitHub Workflow is managed by automation
2+
# https://github.com/hashicorp/terraform-devex-repos
3+
name: 'Lock Threads'
4+
5+
on:
6+
schedule:
7+
- cron: '43 20 * * *'
8+
9+
jobs:
10+
lock:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# NOTE: When TSCCR updates the GitHub action version, update the template workflow file to avoid drift:
14+
# https://github.com/hashicorp/terraform-devex-repos/blob/main/modules/repo/workflows/lock.tftpl
15+
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1
16+
with:
17+
github-token: ${{ github.token }}
18+
issue-inactive-days: '30'
19+
issue-lock-reason: resolved
20+
pr-inactive-days: '30'
21+
pr-lock-reason: resolved

.github/workflows/release.yml

+41
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
21+
with:
22+
# Allow goreleaser to access older tag information.
23+
fetch-depth: 0
24+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
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

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
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@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
34+
with:
35+
version: latest
36+
37+
generate:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
41+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
42+
with:
43+
go-version-file: 'go.mod'
44+
cache: true
45+
# Temporarily download Terraform 1.8 prerelease for function documentation support.
46+
# When Terraform 1.8.0 final is released, this can be removed.
47+
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
48+
with:
49+
terraform_version: '1.8.0-alpha20240216'
50+
terraform_wrapper: false
51+
- run: go generate ./...
52+
- name: git diff
53+
run: |
54+
git diff --compact-summary --exit-code || \
55+
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
56+
57+
# Run acceptance tests in a matrix with Terraform CLI versions
58+
test:
59+
name: Terraform Provider Acceptance Tests
60+
needs: build
61+
runs-on: ubuntu-latest
62+
timeout-minutes: 15
63+
strategy:
64+
fail-fast: false
65+
matrix:
66+
# list whatever Terraform versions here you would like to support
67+
terraform:
68+
- '1.0.*'
69+
- '1.1.*'
70+
- '1.2.*'
71+
- '1.3.*'
72+
- '1.4.*'
73+
steps:
74+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
75+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
76+
with:
77+
go-version-file: 'go.mod'
78+
cache: true
79+
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
80+
with:
81+
terraform_version: ${{ matrix.terraform }}
82+
terraform_wrapper: false
83+
- run: go mod download
84+
- env:
85+
TF_ACC: "1"
86+
run: go test -v -cover ./internal/provider/
87+
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

.golangci.yml

+27
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-per-linter: 0
5+
max-same-issues: 0
6+
7+
linters:
8+
disable-all: true
9+
enable:
10+
- durationcheck
11+
- errcheck
12+
- exportloopref
13+
- forcetypeassert
14+
- godot
15+
- gofmt
16+
- gosimple
17+
- ineffassign
18+
- makezero
19+
- misspell
20+
- nilerr
21+
- predeclared
22+
- staticcheck
23+
- tenv
24+
- unconvert
25+
- unparam
26+
- unused
27+
- vet

.goreleaser.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: 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)