Skip to content

Commit

Permalink
Add labels related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zli82016 committed Sep 29, 2023
1 parent 4ed0c94 commit 71d9185
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

NOTES:
* provider: some provider default values are now shown at plan-time ([#6395](https://github.com/hashicorp/terraform-provider-google-beta/pull/6395))
* provider: default labels configured on the provider through the new `default_labels` field are now supported. The default labels configured on the provider will be applied to all of the resources with standard `labels` field.
* provider: three label-related fields are now in all of the resources with standard `labels` field. `labels` field is non-authoritative and only manage the labels defined by the users on the resource through Terraform. The new output-only `terraform_labels` field merges the labels defined by the users on the resource through Terraform and the default labels configured on the provider. The new output-only `effective_labels` field lists all of labels present on the resource in GCP, including the labels configured through Terraform, the system, and other clients.
* provider: two annotation-related fields are now in all of the resources with standard `annotations` field. The `annotations` field is non-authoritative and only manage the annotations defined by the users on the resource through Terraform. The new output-only `effective_annotations` field lists all of annotations present on the resource in GCP, including the annotations configured through Terraform, the system, and other clients.
* provider: three fields `labels`, `terraform_labels`, and `effective_labels` are now present in most resource-based datasources. All three fields will have all of labels present on the resource in GCP including the labels configured through Terraform, the system, and other clients, equivalent to `effective_labels` on the resource.
* provider: both `annotations` and `effective_annotations` are now present in most resource-based datasources. Both fields will have all of annotations present on the resource in GCP including the annotations configured through Terraform, the system, and other clients, equivalent to `effective_annotations` on the resource.

BREAKING CHANGES:
* provider: added provider-level validation so these fields are not set as empty strings in a user's config: `credentials`, `access_token`, `impersonate_service_account`, `project`, `billing_project`, `region`, `zone` ([#6395](https://github.com/hashicorp/terraform-provider-google-beta/pull/6395))
Expand Down
24 changes: 24 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

# Fixed values- consider setting them in `.bash_profile` or `bashrc`
# REMOTE is the name of the primary repo's remote on your machine. Typically `upstream` or `origin`
REMOTE=origin
# MM_REPO should point to your checked-out copy of the GoogleCloudPlatform/magic-modules repo
MM_REPO="/Users/zhenhuali/Documents/workspace/magic-modules-original"
# https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token, no permissions
export GITHUB_TOKEN=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

# Fill these in each time
# COMMIT_SHA is build.vcs.number in TeamCity
COMMIT_SHA=2aead38a9fd6a7d646cf2a56ce766f21ceaf5912
RELEASE_VERSION=4.82.0
PREVIOUS_RELEASE_VERSION=4.81.0

COMMIT_SHA_OF_LAST_RELEASE=`git merge-base main v${PREVIOUS_RELEASE_VERSION}`
REPO_NAME=$(basename $(git rev-parse --show-toplevel))
# use [ -n "$COMMIT_SHA" ] to make sure COMMIT_SHA is set, `git checkout` is a valid command on its own
git pull $REMOTE main --tags && [ -n "$COMMIT_SHA" ] && git checkout $COMMIT_SHA && git checkout -b release-$RELEASE_VERSION && git push -u $REMOTE release-$RELEASE_VERSION
COMMIT_SHA_OF_LAST_COMMIT_IN_CURRENT_RELEASE=`git rev-list -n 1 HEAD`
go install github.com/paultyng/changelog-gen@91f787dc0cf1eedf016a444740cd28a4f1370e4
changelog-gen -repo $REPO_NAME -branch main -owner hashicorp -changelog ${MM_REPO}/.ci/changelog.tmpl -releasenote ${MM_REPO}/.ci/release-note.tmpl -no-note-label "changelog: no-release-note" $COMMIT_SHA_OF_LAST_RELEASE $COMMIT_SHA_OF_LAST_COMMIT_IN_CURRENT_RELEASE
open https://github.com/hashicorp/$REPO_NAME/edit/release-$RELEASE_VERSION/CHANGELOG.md
13 changes: 13 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash

go list ./google-beta/...
SERVICE_LIST=$(go list ./google-beta/... 2>/dev/null | head -n -1)

for service in SERVICE_LIST
do
echo $service

service_folder=$(echo $service | sed 's/github.com\/hashicorp\/terraform-provider-google-beta/./')
echo $service_folder
cd ${service_folder}
done

0 comments on commit 71d9185

Please sign in to comment.