Skip to content

Commit 17cb959

Browse files
authored
Incorporate terraform-provider-scaffolding (#107)
* Test workflow * Add registry manifest * Remove CircleCI * Pass secrets to workflow * Update README.md * Fix sentry_rule test * Add goreleaser * Upgrade Go packages * Release workflow
1 parent 01c889a commit 17cb959

10 files changed

+263
-127
lines changed

Diff for: .circleci/config.yml

-38
This file was deleted.

Diff for: .github/workflows/release.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
# You will need to pass the `--batch` flag to `gpg` in your signing step
5+
# in `goreleaser` to indicate this is being used in a non-interactive mode.
6+
#
7+
name: release
8+
on:
9+
push:
10+
tags:
11+
- "v*"
12+
jobs:
13+
goreleaser:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
- name: Unshallow
19+
run: git fetch --prune --unshallow
20+
21+
- uses: actions/setup-go@v2
22+
with:
23+
go-version: "1.17"
24+
25+
- name: Import GPG key
26+
id: import_gpg
27+
uses: hashicorp/[email protected]
28+
env:
29+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
30+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
31+
32+
- name: Run GoReleaser
33+
uses: goreleaser/[email protected]
34+
with:
35+
version: latest
36+
args: release --rm-dist
37+
env:
38+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Diff for: .github/workflows/test.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# This GitHub action runs your tests for each commit push and/or PR. Optionally
2+
# you can turn it on using a cron schedule for regular testing.
3+
#
4+
name: Tests
5+
on:
6+
pull_request:
7+
paths-ignore:
8+
- "README.md"
9+
push:
10+
paths-ignore:
11+
- "README.md"
12+
# We test at a regular interval to ensure we are alerted to something breaking due
13+
# to an API change, even if the code did not change.
14+
schedule:
15+
- cron: "0 0 * * *"
16+
jobs:
17+
# ensure the code builds...
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 5
22+
steps:
23+
- uses: actions/setup-go@v2
24+
with:
25+
go-version: "1.17"
26+
27+
- uses: actions/checkout@v2
28+
29+
- name: Get dependencies
30+
run: |
31+
go mod download
32+
33+
- name: Build
34+
run: |
35+
go build -v .
36+
37+
# run acceptance tests in a matrix with Terraform core versions
38+
test:
39+
name: Matrix Test
40+
needs: build
41+
runs-on: ubuntu-latest
42+
timeout-minutes: 15
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
# list whatever Terraform versions here you would like to support
47+
terraform:
48+
- "0.12.*"
49+
- "0.13.*"
50+
- "0.14.*"
51+
- "0.15.*"
52+
- "1.0.*"
53+
- "1.1.*"
54+
steps:
55+
- uses: actions/setup-go@v2
56+
with:
57+
go-version: "1.17"
58+
59+
- uses: hashicorp/setup-terraform@v1
60+
with:
61+
terraform_version: ${{ matrix.terraform }}
62+
terraform_wrapper: false
63+
64+
- uses: actions/checkout@v2
65+
66+
- name: Get dependencies
67+
run: |
68+
go mod download
69+
70+
- name: TF acceptance tests
71+
timeout-minutes: 10
72+
env:
73+
SENTRY_TEST_ORGANIZATION: ${{ secrets.SENTRY_TEST_ORGANIZATION }}
74+
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }}
75+
run: |
76+
make testacc

Diff for: .goreleaser.yml

+19-8
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ before:
66
- go mod tidy
77
builds:
88
- 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.
912
- CGO_ENABLED=0
13+
mod_timestamp: "{{ .CommitTimestamp }}"
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- "-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}"
1018
goos:
1119
- freebsd
12-
- openbsd
13-
- solaris
1420
- windows
1521
- linux
1622
- darwin
@@ -22,28 +28,33 @@ builds:
2228
ignore:
2329
- goos: darwin
2430
goarch: "386"
25-
- goos: openbsd
26-
goarch: arm
27-
- goos: openbsd
28-
goarch: arm64
2931
binary: "{{ .ProjectName }}_v{{ .Version }}"
3032
archives:
3133
- format: zip
3234
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
3335
checksum:
36+
extra_files:
37+
- glob: "terraform-registry-manifest.json"
38+
name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
3439
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
3540
algorithm: sha256
3641
signs:
3742
- artifacts: checksum
3843
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"
3947
- "--local-user"
40-
- "28C93998EF68D65A"
48+
- "{{ .Env.GPG_FINGERPRINT }}"
4149
- "--output"
4250
- "${signature}"
4351
- "--detach-sign"
4452
- "${artifact}"
4553
release:
46-
# Visit your project's GitHub Releases page to publish this release.
54+
extra_files:
55+
- glob: "terraform-registry-manifest.json"
56+
name_template: "{{ .ProjectName }}_{{ .Version }}_manifest.json"
57+
# Manually examine the release before it goes live:
4758
draft: true
4859
changelog:
4960
skip: true

Diff for: .prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

Diff for: README.md

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# terraform-provider-sentry
22

3-
[![CircleCI](https://circleci.com/gh/jianyuan/terraform-provider-sentry/tree/master.svg?style=svg)](https://circleci.com/gh/jianyuan/terraform-provider-sentry/tree/master)
43
[![Go Report Card](https://goreportcard.com/badge/github.com/jianyuan/terraform-provider-sentry)](https://goreportcard.com/report/github.com/jianyuan/terraform-provider-sentry)
54

65
Terraform provider for [Sentry](https://sentry.io).
@@ -19,15 +18,15 @@ Pre-compiled binaries are available from the [Releases](https://github.com/jiany
1918

2019
## Development
2120

21+
If you wish to work on the provider, you will need to install [Go](https://go.dev/doc/install) (We use >= 1.17) on your machine.
22+
2223
### Test
2324

24-
Test the provider by running `make test`.
25+
In order to run the full suite of acceptance tests, run `make testacc`.
2526

26-
Make sure to set the following environment variables:
27+
Make sure to set the following environment variables beforehand:
2728

2829
- `SENTRY_TEST_ORGANIZATION`
2930
- `SENTRY_TOKEN`
3031

31-
### Build
32-
33-
See the [Writing Custom Providers page of the Terraform documentation](https://www.terraform.io/docs/extend/writing-custom-providers.html#building-the-plugin) for instructions.
32+
*Note:* Acceptance tests create real resources, and often cost money to run.

Diff for: go.mod

+44-16
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,64 @@ module github.com/jianyuan/terraform-provider-sentry
22

33
replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 // indirect
44

5-
go 1.14
5+
go 1.17
6+
7+
require (
8+
github.com/hashicorp/terraform-plugin-sdk/v2 v2.10.1
9+
github.com/jianyuan/go-sentry v1.2.1-0.20201022193837-4bc7bd117d9d
10+
github.com/mitchellh/mapstructure v1.4.3
11+
)
612

713
require (
814
cloud.google.com/go v0.70.0 // indirect
915
cloud.google.com/go/storage v1.12.0 // indirect
1016
github.com/agext/levenshtein v1.2.3 // indirect
1117
github.com/apparentlymart/go-cidr v1.1.0 // indirect
18+
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
1219
github.com/aws/aws-sdk-go v1.35.13 // indirect
13-
github.com/dghubble/sling v1.3.0 // indirect
14-
github.com/fatih/color v1.12.0 // indirect
20+
github.com/davecgh/go-spew v1.1.1 // indirect
21+
github.com/dghubble/sling v1.4.0 // indirect
22+
github.com/fatih/color v1.13.0 // indirect
23+
github.com/golang/protobuf v1.5.2 // indirect
24+
github.com/google/go-cmp v0.5.6 // indirect
1525
github.com/google/go-querystring v1.1.0 // indirect
1626
github.com/hashicorp/errwrap v1.1.0 // indirect
17-
github.com/hashicorp/go-hclog v0.16.2 // indirect
27+
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
28+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
29+
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
30+
github.com/hashicorp/go-hclog v1.0.0 // indirect
1831
github.com/hashicorp/go-multierror v1.1.1 // indirect
19-
github.com/hashicorp/go-plugin v1.4.2 // indirect
32+
github.com/hashicorp/go-plugin v1.4.3 // indirect
2033
github.com/hashicorp/go-uuid v1.0.2 // indirect
21-
github.com/hashicorp/hcl/v2 v2.10.1 // indirect
22-
github.com/hashicorp/terraform-plugin-go v0.3.1 // indirect
23-
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
24-
github.com/hashicorp/yamux v0.0.0-20210826001029-26ff87cf9493 // indirect
25-
github.com/jianyuan/go-sentry v1.2.1-0.20201022193837-4bc7bd117d9d
26-
github.com/mattn/go-isatty v0.0.13 // indirect
34+
github.com/hashicorp/go-version v1.3.0 // indirect
35+
github.com/hashicorp/hc-install v0.3.1 // indirect
36+
github.com/hashicorp/hcl/v2 v2.11.1 // indirect
37+
github.com/hashicorp/logutils v1.0.0 // indirect
38+
github.com/hashicorp/terraform-exec v0.15.0 // indirect
39+
github.com/hashicorp/terraform-json v0.13.0 // indirect
40+
github.com/hashicorp/terraform-plugin-go v0.5.0 // indirect
41+
github.com/hashicorp/terraform-plugin-log v0.2.1 // indirect
42+
github.com/hashicorp/terraform-registry-address v0.0.0-20210816115301-cb2034eba045 // indirect
43+
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
44+
github.com/hashicorp/yamux v0.0.0-20211028200310-0bc27b27de87 // indirect
45+
github.com/mattn/go-colorable v0.1.12 // indirect
46+
github.com/mattn/go-isatty v0.0.14 // indirect
47+
github.com/mitchellh/copystructure v1.2.0 // indirect
2748
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
2849
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
29-
github.com/mitchellh/mapstructure v1.4.1
50+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
3051
github.com/oklog/run v1.1.0 // indirect
31-
github.com/zclconf/go-cty v1.9.1 // indirect
32-
golang.org/x/net v0.0.0-20210825183410-e898025ed96a // indirect
33-
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
52+
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
53+
github.com/zclconf/go-cty v1.10.0 // indirect
54+
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e // indirect
55+
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
56+
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f // indirect
57+
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
3458
golang.org/x/text v0.3.7 // indirect
59+
golang.org/x/tools v0.1.5 // indirect
60+
google.golang.org/api v0.33.0 // indirect
3561
google.golang.org/appengine v1.6.7 // indirect
36-
google.golang.org/genproto v0.0.0-20210830153122-0bac4d21c8ea // indirect
62+
google.golang.org/genproto v0.0.0-20211223182754-3ac035c7e7cb // indirect
63+
google.golang.org/grpc v1.43.0 // indirect
64+
google.golang.org/protobuf v1.27.1 // indirect
3765
)

0 commit comments

Comments
 (0)