Skip to content

Commit 8c65bd7

Browse files
committed
Initial Commit
0 parents  commit 8c65bd7

35 files changed

+2864
-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/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

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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-comment: >
19+
I'm going to lock this issue because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active issues.
20+
21+
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
22+
issue-inactive-days: '30'
23+
pr-comment: >
24+
I'm going to lock this pull request because it has been closed for _30 days_ ⏳. This helps our maintainers find and focus on the active contributions.
25+
26+
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
27+
pr-inactive-days: '30'

.github/workflows/release.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
env:
16+
GOPRIVATE: github.com/joescharf/*
17+
18+
jobs:
19+
goreleaser:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Add SSH Go Module Private Key
23+
env:
24+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
25+
run: |
26+
mkdir -p ~/.ssh
27+
ssh-keyscan github.com >> ~/.ssh/known_hosts
28+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
29+
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
30+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
31+
32+
- name: Setup access for private go modules
33+
run: |
34+
git config --global url."ssh://[email protected]/joescharf/dbsnapper-cli.git".insteadOf https://github.com/joescharf/dbsnapper
35+
36+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
37+
with:
38+
# Allow goreleaser to access older tag information.
39+
fetch-depth: 0
40+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
41+
with:
42+
go-version-file: 'go.mod'
43+
cache: true
44+
- name: Import GPG key
45+
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
46+
id: import_gpg
47+
with:
48+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
49+
passphrase: ${{ secrets.PASSPHRASE }}
50+
- name: Run GoReleaser
51+
uses: goreleaser/goreleaser-action@5742e2a039330cbb23ebf35f046f814d4c6ff811 # v5.1.0
52+
with:
53+
args: release --clean
54+
env:
55+
# GitHub sets the GITHUB_TOKEN secret automatically.
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/test.yml

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Terraform Provider testing workflow.
2+
# https://aran.dev/posts/github-actions-go-private-modules/
3+
# https://docs.github.com/en/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys
4+
5+
name: Tests
6+
7+
# This GitHub action runs your tests for each pull request and push.
8+
# Optionally, you can turn it on using a schedule for regular testing.
9+
on:
10+
pull_request:
11+
paths-ignore:
12+
- 'README.md'
13+
push:
14+
paths-ignore:
15+
- 'README.md'
16+
17+
# Testing only needs permissions to read the repository contents.
18+
permissions:
19+
contents: write
20+
env:
21+
GOPRIVATE: github.com/joescharf/*
22+
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+
- name: Add SSH Go Module Private Key
32+
env:
33+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
34+
run: |
35+
mkdir -p ~/.ssh
36+
ssh-keyscan github.com >> ~/.ssh/known_hosts
37+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
38+
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
39+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
40+
41+
- name: Setup access for private go modules
42+
run: |
43+
git config --global url."ssh://[email protected]/joescharf/dbsnapper-cli.git".insteadOf https://github.com/joescharf/dbsnapper
44+
45+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
46+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
47+
with:
48+
go-version-file: 'go.mod'
49+
cache: true
50+
- run: go mod download
51+
- run: go build -v .
52+
- name: Run linters
53+
uses: golangci/golangci-lint-action@a4f60bb28d35aeee14e6880718e0c85ff1882e64 # v6.0.1
54+
with:
55+
version: latest
56+
57+
generate:
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Add SSH Go Module Private Key
61+
env:
62+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
63+
run: |
64+
mkdir -p ~/.ssh
65+
ssh-keyscan github.com >> ~/.ssh/known_hosts
66+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
67+
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
68+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
69+
70+
- name: Setup access for private go modules
71+
run: |
72+
git config --global url."ssh://[email protected]/joescharf/dbsnapper-cli.git".insteadOf https://github.com/joescharf/dbsnapper
73+
74+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
75+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
76+
with:
77+
go-version-file: 'go.mod'
78+
cache: true
79+
# Temporarily download Terraform 1.8 prerelease for function documentation support.
80+
# When Terraform 1.8.0 final is released, this can be removed.
81+
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
82+
with:
83+
terraform_version: '1.8.0-alpha20240216'
84+
terraform_wrapper: false
85+
- run: go generate ./...
86+
- name: git diff
87+
run: |
88+
git diff --compact-summary --exit-code || \
89+
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
90+
91+
# Run acceptance tests in a matrix with Terraform CLI versions
92+
# Max parallel = 1 otherwise the tests will fail due to state conflicts.
93+
test:
94+
name: Terraform Provider Acceptance Tests
95+
needs: build
96+
runs-on: ubuntu-latest
97+
timeout-minutes: 15
98+
strategy:
99+
fail-fast: false
100+
max-parallel: 1
101+
matrix:
102+
# list whatever Terraform versions here you would like to support
103+
terraform:
104+
- '1.6.*'
105+
- '1.7.*'
106+
- '1.8.*'
107+
steps:
108+
- name: Add SSH Go Module Private Key
109+
env:
110+
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
111+
run: |
112+
mkdir -p ~/.ssh
113+
ssh-keyscan github.com >> ~/.ssh/known_hosts
114+
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
115+
ssh-add - <<< "${{ secrets.DEPLOY_KEY }}"
116+
echo "SSH_AUTH_SOCK=$SSH_AUTH_SOCK" >> $GITHUB_ENV
117+
118+
- name: Setup access for private go modules
119+
run: |
120+
git config --global url."ssh://[email protected]/joescharf/dbsnapper-cli.git".insteadOf https://github.com/joescharf/dbsnapper
121+
122+
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
123+
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
124+
with:
125+
go-version-file: 'go.mod'
126+
cache: true
127+
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 # v3.1.1
128+
with:
129+
terraform_version: ${{ matrix.terraform }}
130+
terraform_wrapper: false
131+
- run: go mod download
132+
- env:
133+
TF_ACC: "1"
134+
DBSNAPPER_AUTHTOKEN: ${{ secrets.DBSNAPPER_AUTHTOKEN }}
135+
run: go test -v -cover ./internal/provider/
136+
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

0 commit comments

Comments
 (0)