Skip to content

Commit 04beb76

Browse files
authored
First version of the provider (#2)
1 parent e890172 commit 04beb76

23 files changed

+1359
-0
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Hi there,
2+
3+
Thank you for opening an issue. Please provide the following information:
4+
5+
### Terraform Version
6+
Run `terraform -v` to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.
7+
8+
### Affected Resource(s)
9+
Please list the resources as a list, for example:
10+
- opc_instance
11+
- opc_storage_volume
12+
13+
If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.
14+
15+
### Terraform Configuration Files
16+
```hcl
17+
# Copy-paste your Terraform configurations here - for large Terraform configs,
18+
# please use a service like Dropbox and share a link to the ZIP file. For
19+
# security, you can also encrypt the files using our GPG public key.
20+
```
21+
22+
### Debug Output
23+
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
24+
25+
### Panic Output
26+
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the `crash.log`.
27+
28+
### Expected Behavior
29+
What should have happened?
30+
31+
### Actual Behavior
32+
What actually happened?
33+
34+
### Steps to Reproduce
35+
Please list the steps required to reproduce the issue, for example:
36+
1. `terraform apply`
37+
38+
### Important Factoids
39+
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs?
40+
41+
### References
42+
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
43+
- GH-1234

.github/SUPPORT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Support
2+
3+
Terraform is a mature project with a growing community. There are active, dedicated people willing to help you through various mediums.
4+
5+
Take a look at those mediums listed at https://www.terraform.io/community.html

.github/workflows/golangci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Golangci-Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
jobs:
9+
lint:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/[email protected]
14+
15+
- name: Setup Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: 1.23.x
19+
20+
- run: go mod vendor
21+
22+
- name: Run golangci-lint
23+
uses: golangci/golangci-lint-action@v6
24+
with:
25+
version: v1.64.8

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This GitHub action can publish assets for release when a tag is created.
2+
# Currently its setup to run on any tag that matches the pattern "v*" (ie. v0.1.0).
3+
#
4+
# This uses an action (hashicorp/ghaction-import-gpg) that assumes you set your
5+
# private key in the `GPG_PRIVATE_KEY` secret and passphrase in the `PASSPHRASE`
6+
# secret. If you would rather own your own GPG handling, please fork this action
7+
# or use an alternative one for key handling.
8+
#
9+
# You will need to pass the `--batch` flag to `gpg` in your signing step
10+
# in `goreleaser` to indicate this is being used in a non-interactive mode.
11+
#
12+
name: release
13+
on:
14+
push:
15+
tags:
16+
- 'v*'
17+
jobs:
18+
goreleaser:
19+
runs-on: ubuntu-latest
20+
steps:
21+
-
22+
name: Checkout
23+
uses: actions/checkout@v3
24+
-
25+
name: Unshallow
26+
run: git fetch --prune --unshallow
27+
-
28+
name: Set up Go
29+
uses: actions/setup-go@v3
30+
with:
31+
go-version: '1.20'
32+
-
33+
name: Import GPG key
34+
id: import_gpg
35+
uses: crazy-max/ghaction-import-gpg@v5
36+
with:
37+
# These secrets will need to be configured for the repository:
38+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
39+
passphrase: ${{ secrets.PASSPHRASE }}
40+
-
41+
name: Run GoReleaser
42+
uses: goreleaser/goreleaser-action@v3
43+
with:
44+
version: latest
45+
args: release --clean
46+
env:
47+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
48+
# GitHub sets this automatically
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: '1.23'
21+
22+
- name: test
23+
run: make test
24+
25+
- name: vet
26+
run: make vet
27+
28+
- name: testacc
29+
run: make testacc

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
./*.tfstate
2+
.terraform/
3+
.terraform.lock.hcl*
4+
*.log
5+
.*.swp
6+
tests/docker-compose.*.yml
7+
terraform-elkaliases-postgresql

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.23

.golangci.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
issues:
2+
exclude-rules:
3+
- linters:
4+
- errcheck
5+
text: "Error return value of `d.Set` is not checked"
6+
run:
7+
timeout: 5m

.goreleaser.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 Terraform Cloud 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+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
38+
algorithm: sha256
39+
signs:
40+
- artifacts: checksum
41+
args:
42+
# if you are using this is a GitHub action or some other automated pipeline, you
43+
# need to pass the batch flag to indicate its not interactive.
44+
- "--batch"
45+
- "--local-user"
46+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
47+
- "--output"
48+
- "${signature}"
49+
- "--detach-sign"
50+
- "${artifact}"
51+
release:
52+
# Visit your project's GitHub Releases page to publish this release.
53+
#draft: true
54+
changelog:
55+
disable: true

Makefile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
GO_FILES?=$$(find . -name '*.go')
2+
TEST_FOLDER:=test
3+
4+
build: fmtcheck
5+
go install
6+
7+
test: fmtcheck
8+
go test $(TEST) || exit 1
9+
echo $(TEST) | \
10+
xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4
11+
12+
testacc: fmtcheck
13+
@sh -c "$(TEST_FOLDER)/testacc.sh"
14+
15+
vet:
16+
@echo "go vet ."
17+
@go vet $$(go list ./...) ; if [ $$? -eq 1 ]; then \
18+
echo ""; \
19+
echo "Vet found suspicious constructs. Please check the reported constructs"; \
20+
echo "and fix them if necessary before submitting the code for review."; \
21+
exit 1; \
22+
fi
23+
24+
fmt:
25+
gofmt -w $(GO_FILES)
26+
27+
fmtcheck:
28+
@sh -c "$(TEST_FOLDER)/gofmtcheck.sh"
29+
30+
.PHONY: build test testacc vet fmt fmtcheck

0 commit comments

Comments
 (0)