Skip to content

Commit 591f0b1

Browse files
committed
Sync up with terraform-provider-scaffolding
1 parent fcda539 commit 591f0b1

File tree

13 files changed

+544
-96
lines changed

13 files changed

+544
-96
lines changed

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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-file: 'go.mod'
32+
cache: true
33+
-
34+
name: Import GPG key
35+
id: import_gpg
36+
uses: hashicorp/[email protected]
37+
env:
38+
# These secrets will need to be configured for the repository:
39+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
40+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
41+
-
42+
name: Run GoReleaser
43+
uses: goreleaser/[email protected]
44+
with:
45+
version: latest
46+
args: release --rm-dist
47+
env:
48+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
49+
# GitHub sets this automatically
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
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+
# For systems with an upstream API that could drift unexpectedly (like most SaaS systems, etc.),
13+
# we recommend testing at a regular interval not necessarily tied to code changes. This will
14+
# ensure you are alerted to something breaking due to an API change, even if the code did not
15+
# change.
16+
# schedule:
17+
# - cron: '0 13 * * *'
18+
jobs:
19+
# ensure the code builds...
20+
build:
21+
name: Build
22+
runs-on: ubuntu-latest
23+
timeout-minutes: 5
24+
steps:
25+
26+
- name: Check out code into the Go module directory
27+
uses: actions/checkout@v3
28+
29+
- name: Set up Go
30+
uses: actions/setup-go@v3
31+
with:
32+
go-version-file: 'go.mod'
33+
cache: true
34+
id: go
35+
36+
- name: Get dependencies
37+
run: |
38+
go mod download
39+
40+
- name: Build
41+
run: |
42+
go build -v .
43+
44+
generate:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v3
48+
- uses: actions/setup-go@v3
49+
with:
50+
go-version-file: 'go.mod'
51+
cache: true
52+
- run: go generate ./...
53+
- name: git diff
54+
run: |
55+
git diff --compact-summary --exit-code || \
56+
(echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1)
57+
58+
# run acceptance tests in a matrix with Terraform core versions
59+
test:
60+
name: Matrix Test
61+
needs: build
62+
runs-on: ubuntu-latest
63+
timeout-minutes: 15
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
# list whatever Terraform versions here you would like to support
68+
terraform:
69+
- '0.12.*'
70+
- '0.13.*'
71+
- '0.14.*'
72+
- '0.15.*'
73+
- '1.0.*'
74+
- '1.1.*'
75+
steps:
76+
77+
- name: Check out code into the Go module directory
78+
uses: actions/checkout@v3
79+
80+
- name: Set up Go
81+
uses: actions/setup-go@v3
82+
with:
83+
go-version-file: 'go.mod'
84+
cache: true
85+
id: go
86+
87+
- uses: hashicorp/setup-terraform@v2
88+
with:
89+
terraform_version: ${{ matrix.terraform }}
90+
terraform_wrapper: false
91+
92+
- name: Get dependencies
93+
run: |
94+
go mod download
95+
96+
- name: TF acceptance tests
97+
timeout-minutes: 10
98+
env:
99+
TF_ACC: "1"
100+
101+
# Set whatever additional acceptance test env vars here. You can
102+
# optionally use data from your repository secrets using the
103+
# following syntax:
104+
# SOME_VAR: ${{ secrets.SOME_VAR }}
105+
106+
run: |
107+
go test -v -cover ./internal/provider/

.goreleaser.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
before:
4+
hooks:
5+
# this is just an example and not a requirement for provider building/publishing
6+
- go mod tidy
7+
builds:
8+
- 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.
12+
- CGO_ENABLED=0
13+
mod_timestamp: '{{ .CommitTimestamp }}'
14+
flags:
15+
- -trimpath
16+
ldflags:
17+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
18+
goos:
19+
- freebsd
20+
- windows
21+
- linux
22+
- darwin
23+
goarch:
24+
- amd64
25+
- '386'
26+
- arm
27+
- arm64
28+
ignore:
29+
- goos: darwin
30+
goarch: '386'
31+
binary: '{{ .ProjectName }}_v{{ .Version }}'
32+
archives:
33+
- format: zip
34+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
35+
checksum:
36+
extra_files:
37+
- glob: 'terraform-registry-manifest.json'
38+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
39+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
40+
algorithm: sha256
41+
signs:
42+
- artifacts: checksum
43+
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"
47+
- "--local-user"
48+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
49+
- "--output"
50+
- "${signature}"
51+
- "--detach-sign"
52+
- "${artifact}"
53+
release:
54+
extra_files:
55+
- glob: 'terraform-registry-manifest.json'
56+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
57+
# If you want to manually examine the release before its live, uncomment this line:
58+
# draft: true
59+
changelog:
60+
skip: true

.vscode/launch.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Acceptance Tests",
9+
"type": "go",
10+
"request": "launch",
11+
"mode": "test",
12+
// this assumes your workspace is the root of the repo
13+
"program": "${fileDirname}",
14+
"env": {
15+
"TF_ACC": "1",
16+
},
17+
"args": [],
18+
},
19+
{
20+
"name": "Debug - Attach External CLI",
21+
"type": "go",
22+
"request": "launch",
23+
"mode": "debug",
24+
// this assumes your workspace is the root of the repo
25+
"program": "${workspaceFolder}",
26+
"env": {},
27+
"args": [
28+
// pass the debug flag for reattaching
29+
"-debug",
30+
],
31+
}
32+
]
33+
}

contentstack/provider.go

Lines changed: 0 additions & 72 deletions
This file was deleted.

go.mod

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,65 @@ module github.com/labd/terraform-provider-contentstack
33
go 1.18
44

55
require (
6+
github.com/hashicorp/terraform-plugin-docs v0.9.0
67
github.com/hashicorp/terraform-plugin-sdk/v2 v2.17.0
78
github.com/labd/contentstack-go-sdk v0.0.0-20220601205503-1c6e3a296053
89
)
910

1011
require (
12+
github.com/Masterminds/goutils v1.1.1 // indirect
13+
github.com/Masterminds/semver/v3 v3.1.1 // indirect
14+
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
1115
github.com/agext/levenshtein v1.2.2 // indirect
1216
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
13-
github.com/fatih/color v1.7.0 // indirect
17+
github.com/armon/go-radix v1.0.0 // indirect
18+
github.com/bgentry/speakeasy v0.1.0 // indirect
19+
github.com/fatih/color v1.13.0 // indirect
1420
github.com/golang/protobuf v1.5.2 // indirect
1521
github.com/google/go-cmp v0.5.8 // indirect
16-
github.com/hashicorp/errwrap v1.0.0 // indirect
22+
github.com/google/uuid v1.3.0 // indirect
23+
github.com/hashicorp/errwrap v1.1.0 // indirect
24+
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
25+
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
1726
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
1827
github.com/hashicorp/go-hclog v1.2.0 // indirect
1928
github.com/hashicorp/go-multierror v1.1.1 // indirect
2029
github.com/hashicorp/go-plugin v1.4.4 // indirect
2130
github.com/hashicorp/go-uuid v1.0.3 // indirect
2231
github.com/hashicorp/go-version v1.5.0 // indirect
32+
github.com/hashicorp/hc-install v0.3.2 // indirect
2333
github.com/hashicorp/hcl/v2 v2.12.0 // indirect
2434
github.com/hashicorp/logutils v1.0.0 // indirect
35+
github.com/hashicorp/terraform-exec v0.16.1 // indirect
36+
github.com/hashicorp/terraform-json v0.14.0 // indirect
2537
github.com/hashicorp/terraform-plugin-go v0.9.1 // indirect
2638
github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect
2739
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
2840
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
2941
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
30-
github.com/mattn/go-colorable v0.1.4 // indirect
31-
github.com/mattn/go-isatty v0.0.10 // indirect
42+
github.com/huandu/xstrings v1.3.2 // indirect
43+
github.com/imdario/mergo v0.3.13 // indirect
44+
github.com/mattn/go-colorable v0.1.12 // indirect
45+
github.com/mattn/go-isatty v0.0.14 // indirect
46+
github.com/mitchellh/cli v1.1.4 // indirect
3247
github.com/mitchellh/copystructure v1.2.0 // indirect
3348
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
3449
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
3550
github.com/mitchellh/mapstructure v1.5.0 // indirect
3651
github.com/mitchellh/reflectwalk v1.0.2 // indirect
3752
github.com/oklog/run v1.0.0 // indirect
53+
github.com/posener/complete v1.2.3 // indirect
54+
github.com/russross/blackfriday v1.6.0 // indirect
55+
github.com/shopspring/decimal v1.3.1 // indirect
56+
github.com/spf13/cast v1.5.0 // indirect
3857
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
3958
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
4059
github.com/vmihailenco/tagparser v0.1.1 // indirect
4160
github.com/zclconf/go-cty v1.10.0 // indirect
42-
golang.org/x/net v0.0.0-20210326060303-6b1517762897 // indirect
43-
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1 // indirect
44-
golang.org/x/text v0.3.5 // indirect
61+
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
62+
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
63+
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a // indirect
64+
golang.org/x/text v0.3.7 // indirect
4565
google.golang.org/appengine v1.6.6 // indirect
4666
google.golang.org/genproto v0.0.0-20200711021454-869866162049 // indirect
4767
google.golang.org/grpc v1.46.0 // indirect

0 commit comments

Comments
 (0)