-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add labels field to the GKEHub Scope resource and make it updatable (#…
…8882) (#15801) * Adding Terraform resources for Tenancy APIs in GKEHub * Segregating MembershipBinding and MembershipRBACRoleBinding to keep things simpler in the review * Fixing the docu URIs * Adding TF support for Tenancy API for Membership Binding * Adding dependent membership binding to the same commit chain * Making Scope un-updatable and replacing hard coded project number with the one from test env * Making Scope RRBAC updatable * Making Namespace immutable * Adding update test cases * Removing all memberships field from Scope since it is no longer supported * Removing all_memberships field for Scope from all test cases * Adding labels field to the GKEHub Scope resource * Fixing typo in the comment Signed-off-by: Modular Magician <[email protected]>
- Loading branch information
1 parent
caffa8a
commit 77fa016
Showing
6 changed files
with
222 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:enhancement | ||
gkehub: added `labels` fields to `google_gke_hub_scope` resource | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// Copyright (c) HashiCorp, Inc. | ||
// SPDX-License-Identifier: MPL-2.0 | ||
package gkehub2_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
"github.com/hashicorp/terraform-provider-google/google/envvar" | ||
) | ||
|
||
func TestAccGKEHub2Scope_gkehubScopeBasicExample_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"project": envvar.GetTestProjectFromEnv(), | ||
"random_suffix": acctest.RandString(t, 10), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccGKEHub2Scope_gkehubScopeBasicExample_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_gke_hub_scope.scope", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"scope_id"}, | ||
}, | ||
{ | ||
Config: testAccGKEHub2Scope_gkehubScopeBasicExample_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_gke_hub_scope.scope", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"scope_id"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccGKEHub2Scope_gkehubScopeBasicExample_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gke_hub_scope" "scope" { | ||
scope_id = "tf-test-scope%{random_suffix}" | ||
labels = { | ||
keyb = "valueb" | ||
keya = "valuea" | ||
keyc = "valuec" | ||
} | ||
} | ||
`, context) | ||
} | ||
|
||
func testAccGKEHub2Scope_gkehubScopeBasicExample_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gke_hub_scope" "scope" { | ||
scope_id = "tf-test-scope%{random_suffix}" | ||
labels = { | ||
updated_keyb = "updated_valueb" | ||
updated_keya = "updated_valuea" | ||
updated_keyc = "updated_valuec" | ||
} | ||
} | ||
`, context) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters