Skip to content

Commit 633eb8f

Browse files
yuhuyoyoCopybara
andauthored
Project import generated by Copybara. (#2)
GitOrigin-RevId: a521de1c02d07c5cfe41b1167fed20535a7c6a30 Co-authored-by: Copybara <[email protected]>
1 parent 2254473 commit 633eb8f

File tree

162 files changed

+72815
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+72815
-2
lines changed

.github/workflows/pr-dry-run.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# .github/workflows/pr-dry-run.yml
2+
name: PR Checks and Release Dry Run
3+
4+
on:
5+
pull_request:
6+
branches:
7+
- main
8+
9+
jobs:
10+
changelog_version_check:
11+
uses: ./.github/workflows/reusable-changelog-version-diff.yml
12+
with:
13+
begin_ref: ${{ github.event.pull_request.base.sha }}
14+
end_ref: ${{ github.event.pull_request.head.sha }}
15+
16+
changelog_version_enforce:
17+
runs-on: ubuntu-latest
18+
needs: changelog_version_check
19+
permissions:
20+
pull-requests: write
21+
contents: read
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Check if tag for new version exists
27+
if: ${{ needs.changelog_version_check.outputs.before_version != needs.changelog_version_check.outputs.after_version }}
28+
run: |
29+
git fetch --tags
30+
if git tag --list "${{ needs.changelog_version_check.outputs.after_version }}" | grep -q .; then
31+
echo "::error::Tag ${{ needs.changelog_version_check.outputs.after_version }} already exists. Please update the version in CHANGELOG.md."
32+
exit 1
33+
fi
34+
35+
- name: Add/Update PR comment if version did not change
36+
if: ${{ needs.changelog_version_check.outputs.before_version == needs.changelog_version_check.outputs.after_version }}
37+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
issue-number: ${{ github.event.pull_request.number }}
41+
body: |
42+
<!-- changelog-version-warning -->
43+
:warning: Version in CHANGELOG.md did not change (still ${{ needs.changelog_version_check.outputs.before_version }}).
44+
This PR will not result in the creation of a new release.
45+
46+
- name: Add/Update PR comment if version changed
47+
if: ${{ needs.changelog_version_check.outputs.before_version != needs.changelog_version_check.outputs.after_version }}
48+
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
49+
with:
50+
token: ${{ secrets.GITHUB_TOKEN }}
51+
issue-number: ${{ github.event.pull_request.number }}
52+
body: |
53+
<!-- changelog-version-info -->
54+
:information_source: Version in CHANGELOG.md updated to ${{ needs.changelog_version_check.outputs.after_version }}.
55+
This will trigger the creation of a new release when merged into main.
56+
57+
call_dry_run_workflow:
58+
needs: changelog_version_enforce
59+
uses: ./.github/workflows/reusable-release-provider.yml
60+
with:
61+
dry_run: true # This tells the reusable workflow to perform a dry run
62+
secrets:
63+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
64+
PASSPHRASE: ${{ secrets.PASSPHRASE }}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# .github/workflows/reusable-changelog-version-diff.yml
2+
name: Changelog Version Diff
3+
4+
description: >
5+
Compares the version in CHANGELOG.md between two refs and outputs the version and whether it changed.
6+
7+
on:
8+
workflow_call:
9+
inputs:
10+
begin_ref:
11+
required: true
12+
type: string
13+
end_ref:
14+
required: true
15+
type: string
16+
outputs:
17+
before_version:
18+
description: "Version parsed from CHANGELOG.md at begin_ref."
19+
value: ${{ jobs.diff.outputs.before_version }}
20+
after_version:
21+
description: "Version parsed from CHANGELOG.md at end_ref."
22+
value: ${{ jobs.diff.outputs.after_version }}
23+
24+
jobs:
25+
diff:
26+
runs-on: ubuntu-latest
27+
outputs:
28+
before_version: ${{ steps.parse_compare.outputs.before_version }}
29+
after_version: ${{ steps.parse_compare.outputs.after_version }}
30+
steps:
31+
- name: Checkout begin_ref
32+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
33+
with:
34+
ref: ${{ inputs.begin_ref }}
35+
path: begin
36+
37+
- name: Checkout end_ref
38+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
39+
with:
40+
ref: ${{ inputs.end_ref }}
41+
path: end
42+
43+
- name: Parse versions from CHANGELOG.md
44+
id: parse_compare
45+
run: |
46+
# This step parses Terraform version headers from CHANGELOG.md files.
47+
# It expects headers in the format: ## X.Y.Z (see https://developer.hashicorp.com/terraform/plugin/best-practices/versioning#version-headers)
48+
parse_version() {
49+
local file="$1"
50+
if [ ! -f "$file" ]; then
51+
echo "v0.0.0"
52+
return
53+
fi
54+
# Find the first line that starts with '## ' and looks like a version header (e.g., '## 1.2.3')
55+
# 1. grep: get lines that start with '## ' followed by a digit and dot-separated digits
56+
# 2. head: take the first such line
57+
# 3. cut: remove the leading '## ' to get just the version string
58+
local ver_line
59+
ver_line=$(grep -m1 -E '^## [0-9]+(\.[0-9]+)*' "$file" | head -n1)
60+
local ver
61+
if [ -n "$ver_line" ]; then
62+
# Remove the leading '## '
63+
ver=$(echo "$ver_line" | cut -d' ' -f2)
64+
echo "v$ver"
65+
else
66+
echo "v0.0.0"
67+
fi
68+
}
69+
70+
before_version=$(parse_version "begin/CHANGELOG.md")
71+
after_version=$(parse_version "end/CHANGELOG.md")
72+
73+
echo "before_version=$before_version" >> $GITHUB_OUTPUT
74+
echo "after_version=$after_version" >> $GITHUB_OUTPUT
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# .github/workflows/reusable/release-provider.yml
2+
name: Release Terraform Provider
3+
4+
on:
5+
workflow_call:
6+
inputs:
7+
dry_run:
8+
description: 'Run in dry-run mode (build and sign, but do not publish release)'
9+
type: boolean
10+
required: false
11+
default: false
12+
secrets:
13+
GPG_PRIVATE_KEY:
14+
description: 'GPG Private Key for signing releases'
15+
required: true
16+
PASSPHRASE:
17+
description: 'Passphrase for the GPG Private Key'
18+
required: true
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write # Required for goreleaser to create releases
25+
26+
steps:
27+
- name: Checkout Repository
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
29+
with:
30+
fetch-depth: 0 # Required for goreleaser to properly determine version
31+
32+
- name: Set up Go
33+
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
34+
with:
35+
go-version-file: 'go.mod'
36+
cache: true
37+
38+
- name: Import GPG Key
39+
uses: crazy-max/ghaction-import-gpg@e89d40939c28e39f97cf32126055eeae86ba74ec # v6.3.0
40+
id: import_gpg
41+
with:
42+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
43+
passphrase: ${{ secrets.PASSPHRASE }}
44+
45+
- name: Run GoReleaser (Dry Run or Release)
46+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
47+
with:
48+
distribution: goreleaser
49+
args: release --clean ${{ inputs.dry_run && '--snapshot --skip=publish' || '' }}
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# .github/workflows/tag-on-push.yml
2+
name: Tag and Release on Push
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
changelog_version_check:
11+
uses: ./.github/workflows/reusable-changelog-version-diff.yml
12+
with:
13+
begin_ref: ${{ github.event.before }}
14+
end_ref: ${{ github.sha }}
15+
16+
tag_if_version_updated:
17+
runs-on: ubuntu-latest
18+
needs: changelog_version_check
19+
permissions:
20+
contents: write
21+
if: ${{ needs.changelog_version_check.outputs.after_version != needs.changelog_version_check.outputs.before_version }}
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
with:
26+
fetch-depth: 0
27+
- name: Tag and push new version
28+
run: |
29+
git config user.name "github-actions"
30+
git config user.email "[email protected]"
31+
git tag ${{ needs.changelog_version_check.outputs.after_version }}
32+
git push origin ${{ needs.changelog_version_check.outputs.after_version }}
33+
34+
call_release_workflow:
35+
needs: tag_if_version_updated
36+
uses: ./.github/workflows/reusable-release-provider.yml
37+
secrets:
38+
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
39+
PASSPHRASE: ${{ secrets.PASSPHRASE }}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
bin/
2+
terraform-provider-workbench
3+
**/terraform.tfstate.backup

.goreleaser.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Visit https://goreleaser.com for documentation on how to customize this
2+
# behavior.
3+
version: 2
4+
before:
5+
hooks:
6+
# call 'go mod tidy' to ensure that the go.mod and go.sum files are up to
7+
# date. Use the --diff flag to fail the release if this would result in
8+
# changes to the files.
9+
- go mod tidy --diff
10+
builds:
11+
- env:
12+
# goreleaser does not work with CGO, it could also complicate
13+
# usage by users in CI/CD systems like HCP Terraform where
14+
# they are unable to install libraries.
15+
- CGO_ENABLED=0
16+
mod_timestamp: '{{ .CommitTimestamp }}'
17+
flags:
18+
- -trimpath
19+
ldflags:
20+
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
21+
goos:
22+
- freebsd
23+
- windows
24+
- linux
25+
- darwin
26+
goarch:
27+
- amd64
28+
- '386'
29+
- arm
30+
- arm64
31+
ignore:
32+
- goos: darwin
33+
goarch: '386'
34+
binary: '{{ .ProjectName }}_v{{ .Version }}'
35+
archives:
36+
- formats: zip
37+
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
38+
checksum:
39+
extra_files:
40+
- glob: 'terraform-registry-manifest.json'
41+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
42+
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
43+
algorithm: sha256
44+
signs:
45+
- artifacts: checksum
46+
args:
47+
# if you are using this in a GitHub action or some other automated pipeline, you
48+
# need to pass the batch flag to indicate its not interactive.
49+
- "--batch"
50+
- "--local-user"
51+
- "{{ .Env.GPG_FINGERPRINT }}" # set this environment variable for your signing key
52+
- "--output"
53+
- "${signature}"
54+
- "--detach-sign"
55+
- "${artifact}"
56+
release:
57+
extra_files:
58+
- glob: 'terraform-registry-manifest.json'
59+
name_template: '{{ .ProjectName }}_{{ .Version }}_manifest.json'
60+
# If you want to manually examine the release before its live, uncomment this line:
61+
# draft: true
62+
changelog:
63+
disable: true

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
## 0.0.1 (July 23, 2025)
2+
3+
Initial Release
4+
5+
### 🚀 New Features
6+
7+
- Workspace Support
8+
9+
- Added `workbench_workspace` resource for managing provisioned workspaces.
10+
- Added `workbench_workspace` data source to fetch existing workspace details.
11+
- Added `workbench_workspace_iam_policy`, `workbench_workspace_iam_member`, and `workbench_workspace_iam_binding` resources for managing IAM on workspaces.
12+
- Added `workbench_workspace_iam_policy`, `workbench_workspace_iam_binding` data source to fetch existing iam memberships.
13+
14+
- Group Support
15+
16+
- Added `workbench_group` resource for managing provisioned groups.
17+
- Added `workbench_group` data source to fetch existing group details.
18+
- Added `workbench_group_iam_policy`, `workbench_group_iam_member`, and `workbench_group_iam_binding` respirces for managing IAM on groups.
19+
- Added `workbench_group_iam_policy`, `workbench_group_iam_binding` data source to fetch existing iam memberships.
20+
21+
- Data Collection Support
22+
23+
- Added `workbench_data_collection` resource for managing provisioned data collections.
24+
- Added `workbench_data_collection` data source to fetch existing data collection details.
25+
- Added `workbench_data_collection_version` resource for managing data collections versioning and publishing.
26+
- Added `workbench_data_collection_version` data source to fetch existing versions details.
27+
28+
- Workspace folder Support
29+
30+
- Added `workbench_folder` resource for managing workspace folders.
31+
- Added `workbench_folder` data source to fetch existing folder details.
32+
33+
- GCS bucket Support
34+
35+
- Added `workbench_gcs_bucket` resource for managing GCS buckets.
36+
- Added `workbench_gcs_bucket` data source for fetching existing buckets details.
37+

CONTRIBUTING.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# How to contribute
2+
3+
## Reporting issues
4+
5+
Bugs, feature requests, and development-related questions should be directed to
6+
our GitHub issue tracker. If reporting a bug, please try and provide as much
7+
context as possible such as your operating system, Go version, and anything else
8+
that might be relevant to the bug. For feature requests, please explain what
9+
you're trying to do, and how the requested feature would help you do that.
10+
11+
## Pull Request
12+
13+
We don't currently accept pull requests from the public. They will be
14+
automatically closed. If you would like to make a proposal, we will do our best
15+
to review it, implement it ourselves, and include it in the next release. If
16+
enough proposals come through, we will certainly revisit this policy to make
17+
the package as useful as possible.

LICENSE

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2025, Verily
4+
5+
Redistribution and use in source and binary forms, with or without
6+
modification, are permitted provided that the following conditions are met:
7+
8+
1. Redistributions of source code must retain the above copyright notice, this
9+
list of conditions and the following disclaimer.
10+
11+
2. Redistributions in binary form must reproduce the above copyright notice,
12+
this list of conditions and the following disclaimer in the documentation
13+
and/or other materials provided with the distribution.
14+
15+
3. Neither the name of the copyright holder nor the names of its
16+
contributors may be used to endorse or promote products derived from
17+
this software without specific prior written permission.
18+
19+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

0 commit comments

Comments
 (0)