-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a2f4184
Showing
38 changed files
with
2,510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template. | ||
schema_version = 1 | ||
|
||
project { | ||
license = "MPL-2.0" | ||
copyright_year = 2021 | ||
|
||
header_ignore = [ | ||
# examples used within documentation (prose) | ||
"examples/**", | ||
|
||
# GitHub issue template configuration | ||
".github/ISSUE_TEMPLATE/*.yml", | ||
|
||
# golangci-lint tooling configuration | ||
".golangci.yml", | ||
|
||
# GoReleaser tooling configuration | ||
".goreleaser.yml", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
FROM registry.access.redhat.com/ubi9/ubi:latest | ||
|
||
ARG goversion=1.23.1 | ||
|
||
RUN cat <<EOF >> /root/.bashrc | ||
alias ls='ls --color=auto' | ||
alias ll='ls -l --color=auto' | ||
alias la='ls -la --color=auto' | ||
PS1='\n\[\e[0;1;94m\]\W \[\e[0;1;93m\]@\[\e[0;1;93m\]$(git branch --show-current 2>/dev/null)\n\[\e[0;32m\]➜ \[\e[0m\]' | ||
export PATH=$PATH:/usr/local/go/bin | ||
EOF | ||
|
||
RUN cat <<EOF > /root/.terraformrc | ||
provider_installation { | ||
|
||
dev_overrides { | ||
"registry.terraform.io/svalabs/forgejo" = "/root/go/bin" | ||
} | ||
|
||
# For all other providers, install them directly from their origin provider | ||
# registries as normal. If you omit this, Terraform will _only_ use | ||
# the dev_overrides block, and so no other providers will be available. | ||
direct {} | ||
} | ||
EOF | ||
|
||
RUN dnf -y update && \ | ||
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm && \ | ||
/usr/bin/crb enable && \ | ||
dnf config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo && \ | ||
dnf -y install \ | ||
git \ | ||
make \ | ||
terraform && \ | ||
dnf clean all && \ | ||
rm -rf /usr/local/go && \ | ||
curl -L https://go.dev/dl/go${goversion}.linux-amd64.tar.gz | tar -C /usr/local -xzf - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"build": { | ||
"dockerfile": "Dockerfile" | ||
}, | ||
|
||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"esbenp.prettier-vscode", | ||
"hashicorp.terraform", | ||
"golang.go" | ||
] | ||
} | ||
}, | ||
|
||
"securityOpt": ["label=disable"], | ||
"mounts": [], | ||
|
||
"workspaceMount": "type=bind,source=${localWorkspaceFolder},target=/src,ro=false", | ||
"workspaceFolder": "/src", | ||
|
||
"runArgs": ["--net=host"], | ||
|
||
"remoteEnv": {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @hashicorp/terraform-devex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Code of Conduct | ||
|
||
HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code. | ||
|
||
Please read the full text at https://www.hashicorp.com/community-guidelines |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# See GitHub's documentation for more information on this file: | ||
# https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "gomod" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
# TODO: Dependabot only updates hashicorp GHAs in the template repository, the following lines can be removed for consumers of this template | ||
allow: | ||
- dependency-name: "hashicorp/*" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# DO NOT EDIT - This GitHub Workflow is managed by automation | ||
# https://github.com/hashicorp/terraform-devex-repos | ||
name: Issue Comment Triage | ||
|
||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
issue_comment_triage: | ||
runs-on: ubuntu-latest | ||
env: | ||
# issue_comment events are triggered by comments on issues and pull requests. Checking the | ||
# value of github.event.issue.pull_request tells us whether the issue is an issue or is | ||
# actually a pull request, allowing us to dynamically set the gh subcommand: | ||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only | ||
COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }} | ||
GH_TOKEN: ${{ github.token }} | ||
steps: | ||
- name: 'Remove waiting-response on comment' | ||
run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# DO NOT EDIT - This GitHub Workflow is managed by automation | ||
# https://github.com/hashicorp/terraform-devex-repos | ||
name: 'Lock Threads' | ||
|
||
on: | ||
schedule: | ||
- cron: '43 20 * * *' | ||
|
||
jobs: | ||
lock: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# NOTE: When TSCCR updates the GitHub action version, update the template workflow file to avoid drift: | ||
# https://github.com/hashicorp/terraform-devex-repos/blob/main/modules/repo/workflows/lock.tftpl | ||
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1 | ||
with: | ||
github-token: ${{ github.token }} | ||
issue-inactive-days: '30' | ||
issue-lock-reason: resolved | ||
pr-inactive-days: '30' | ||
pr-lock-reason: resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Terraform Provider release workflow. | ||
name: Release | ||
|
||
# This GitHub action creates a release when a tag that matches the pattern | ||
# "v*" (e.g. v0.1.0) is created. | ||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
# Releases need permissions to read and write the repository contents. | ||
# GitHub considers creating releases and uploading assets as writing contents. | ||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
# Allow goreleaser to access older tag information. | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- name: Import GPG key | ||
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0 | ||
id: import_gpg | ||
with: | ||
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | ||
passphrase: ${{ secrets.PASSPHRASE }} | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0 | ||
with: | ||
args: release --clean | ||
env: | ||
# GitHub sets the GITHUB_TOKEN secret automatically. | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Terraform Provider testing workflow. | ||
name: Tests | ||
|
||
# This GitHub action runs your tests for each pull request and push. | ||
# Optionally, you can turn it on using a schedule for regular testing. | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- 'README.md' | ||
push: | ||
paths-ignore: | ||
- 'README.md' | ||
|
||
# Testing only needs permissions to read the repository contents. | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
# Ensure project builds before running testing matrix | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- run: go mod download | ||
- run: go build -v . | ||
- name: Run linters | ||
uses: golangci/golangci-lint-action@aaa42aa0628b4ae2578232a66b541047968fac86 # v6.1.0 | ||
with: | ||
version: latest | ||
|
||
generate: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
# Temporarily download Terraform 1.8 prerelease for function documentation support. | ||
# When Terraform 1.8.0 final is released, this can be removed. | ||
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | ||
with: | ||
terraform_version: '1.8.0-alpha20240216' | ||
terraform_wrapper: false | ||
- run: go generate ./... | ||
- name: git diff | ||
run: | | ||
git diff --compact-summary --exit-code || \ | ||
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1) | ||
# Run acceptance tests in a matrix with Terraform CLI versions | ||
test: | ||
name: Terraform Provider Acceptance Tests | ||
needs: build | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# list whatever Terraform versions here you would like to support | ||
terraform: | ||
- '1.0.*' | ||
- '1.1.*' | ||
- '1.2.*' | ||
- '1.3.*' | ||
- '1.4.*' | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: 'go.mod' | ||
cache: true | ||
- uses: hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2 | ||
with: | ||
terraform_version: ${{ matrix.terraform }} | ||
terraform_wrapper: false | ||
- run: go mod download | ||
- env: | ||
TF_ACC: "1" | ||
run: go test -v -cover ./internal/provider/ | ||
timeout-minutes: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
*.dll | ||
*.exe | ||
.DS_Store | ||
example.tf | ||
terraform.tfplan | ||
terraform.tfstate | ||
bin/ | ||
dist/ | ||
modules-dev/ | ||
/pkg/ | ||
website/.vagrant | ||
website/.bundle | ||
website/build | ||
website/node_modules | ||
.vagrant/ | ||
*.backup | ||
./*.tfstate | ||
.terraform/ | ||
*.log | ||
*.bak | ||
*~ | ||
.*.swp | ||
.idea | ||
*.iml | ||
*.test | ||
*.iml | ||
|
||
website/vendor | ||
|
||
# Test exclusions | ||
!command/test-fixtures/**/*.tfstate | ||
!command/test-fixtures/**/.terraform/ | ||
|
||
# Keep windows files with windows line endings | ||
*.winfile eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Visit https://golangci-lint.run/ for usage documentation | ||
# and information on other useful linters | ||
issues: | ||
max-per-linter: 0 | ||
max-same-issues: 0 | ||
|
||
linters: | ||
disable-all: true | ||
enable: | ||
- durationcheck | ||
- errcheck | ||
- exportloopref | ||
- forcetypeassert | ||
- godot | ||
- gofmt | ||
- gosimple | ||
- ineffassign | ||
- makezero | ||
- misspell | ||
- nilerr | ||
- predeclared | ||
- staticcheck | ||
- tenv | ||
- unconvert | ||
- unparam | ||
- unused | ||
- govet |
Oops, something went wrong.