Skip to content

Commit 509063e

Browse files
Add Gemini Release Channel Setting Binding resource (#12895)
Co-authored-by: Stephen Lewis (Burrows) <[email protected]>
1 parent 15b9d38 commit 509063e

5 files changed

+227
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# Copyright 2025 Google Inc.
2+
# Licensed under the Apache License, Version 2.0 (the "License");
3+
# you may not use this file except in compliance with the License.
4+
# You may obtain a copy of the License at
5+
#
6+
# http://www.apache.org/licenses/LICENSE-2.0
7+
#
8+
# Unless required by applicable law or agreed to in writing, software
9+
# distributed under the License is distributed on an "AS IS" BASIS,
10+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
# See the License for the specific language governing permissions and
12+
# limitations under the License.
13+
14+
---
15+
name: ReleaseChannelSettingBinding
16+
description: The resource for managing ReleaseChannel setting bindings for Admin Control.
17+
references:
18+
guides:
19+
'Gemini Cloud Assist overview': 'https://cloud.google.com/gemini/docs/cloud-assist/overview'
20+
min_version: 'beta'
21+
base_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings
22+
self_link: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
23+
create_url: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings?settingBindingId={{setting_binding_id}}
24+
id_format: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
25+
update_verb: PATCH
26+
update_mask: true
27+
import_format:
28+
- projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}/settingBindings/{{setting_binding_id}}
29+
mutex: projects/{{project}}/locations/{{location}}/releaseChannelSettings/{{release_channel_setting_id}}
30+
examples:
31+
- name: gemini_release_channel_setting_binding_basic
32+
min_version: 'beta'
33+
primary_resource_id: example
34+
exclude_test: true
35+
vars:
36+
release_channel_setting_id: ls-tf1
37+
setting_binding_id: ls-tf1b1
38+
target: projects/980109375338
39+
test_env_vars:
40+
org_id: "ORG_ID"
41+
billing_account: "BILLING_ACCT"
42+
autogen_async: true
43+
async:
44+
operation:
45+
timeouts:
46+
insert_minutes: 90
47+
update_minutes: 90
48+
delete_minutes: 90
49+
base_url: '{{op_id}}'
50+
actions:
51+
- create
52+
- delete
53+
- update
54+
type: OpAsync
55+
result:
56+
resource_inside_response: true
57+
include_project: false
58+
autogen_status: U2V0dGluZ0JpbmRpbmdCeVByb2plY3RBbmRMb2NhdGlvbkFuZFJlbGVhc2VjaGFubmVsc2V0dGluZw==
59+
parameters:
60+
- name: location
61+
type: String
62+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
63+
immutable: true
64+
url_param_only: true
65+
- name: releaseChannelSettingId
66+
type: String
67+
description: Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
68+
immutable: true
69+
url_param_only: true
70+
required: true
71+
- name: settingBindingId
72+
type: String
73+
description: |-
74+
Id of the setting binding.
75+
immutable: true
76+
url_param_only: true
77+
required: true
78+
properties:
79+
- name: name
80+
type: String
81+
description: |-
82+
Identifier. Name of the resource.
83+
Format:projects/{project}/locations/{location}/releaseChannelSettings/{setting}/settingBindings/{setting_binding}
84+
output: true
85+
- name: createTime
86+
type: String
87+
description: Create time stamp.
88+
output: true
89+
- name: updateTime
90+
type: String
91+
description: Update time stamp.
92+
output: true
93+
- name: labels
94+
type: KeyValueLabels
95+
description: Labels as key value pairs.
96+
- name: target
97+
type: String
98+
description: Target of the binding.
99+
required: true
100+
- name: product
101+
type: Enum
102+
description: |-
103+
Product type of the setting binding.
104+
enum_values:
105+
- 'GEMINI_CLOUD_ASSIST'
106+
- 'GEMINI_CODE_ASSIST'

mmv1/templates/terraform/examples/gemini_release_channel_setting_basic.tf.tmpl

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ resource "google_gemini_release_channel_setting" "{{$.PrimaryResourceId}}" {
22
provider = google-beta
33
release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}"
44
location = "global"
5+
labels = {"my_key": "my_value"}
56
release_channel = "EXPERIMENTAL"
67
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
resource "google_gemini_release_channel_setting" "basic" {
2+
provider = google-beta
3+
release_channel_setting_id = "{{index $.Vars "release_channel_setting_id"}}"
4+
location = "global"
5+
labels = {"my_key": "my_value"}
6+
release_channel = "EXPERIMENTAL"
7+
}
8+
9+
resource "google_gemini_release_channel_setting_binding" "{{$.PrimaryResourceId}}" {
10+
provider = google-beta
11+
release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id
12+
setting_binding_id = "{{index $.Vars "setting_binding_id"}}"
13+
location = "global"
14+
target = "{{index $.Vars "target"}}"
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package gemini_test
2+
{{- if ne $.TargetVersionName "ga" }}
3+
4+
import (
5+
"fmt"
6+
"testing"
7+
8+
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
9+
"github.com/hashicorp/terraform-plugin-testing/plancheck"
10+
11+
"github.com/hashicorp/terraform-provider-google/google/acctest"
12+
)
13+
14+
func TestAccGeminiReleaseChannelSettingBinding_update(t *testing.T) {
15+
t.Parallel()
16+
17+
context := map[string]interface{}{
18+
"release_channel_setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)),
19+
"setting_binding_id": fmt.Sprintf("tf-test-lsb-%s", acctest.RandString(t, 10)),
20+
}
21+
22+
acctest.VcrTest(t, resource.TestCase{
23+
PreCheck: func() { acctest.AccTestPreCheck(t) },
24+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderBetaFactories(t),
25+
Steps: []resource.TestStep{
26+
{
27+
Config: testAccGeminiReleaseChannelSettingBinding_basic(context),
28+
},
29+
{
30+
ResourceName: "google_gemini_release_channel_setting_binding.basic_binding",
31+
ImportState: true,
32+
ImportStateVerify: true,
33+
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
34+
},
35+
{
36+
Config: testAccGeminiReleaseChannelSettingBinding_update(context),
37+
ConfigPlanChecks: resource.ConfigPlanChecks{
38+
PreApply: []plancheck.PlanCheck{
39+
plancheck.ExpectResourceAction("google_gemini_release_channel_setting_binding.basic_binding", plancheck.ResourceActionUpdate),
40+
},
41+
},
42+
},
43+
{
44+
ResourceName: "google_gemini_release_channel_setting_binding.basic_binding",
45+
ImportState: true,
46+
ImportStateVerify: true,
47+
ImportStateVerifyIgnore: []string{"labels", "location", "release_channel_setting_id", "terraform_labels"},
48+
},
49+
},
50+
})
51+
}
52+
53+
func testAccGeminiReleaseChannelSettingBinding_basic(context map[string]interface{}) string {
54+
return acctest.Nprintf(`
55+
data "google_project" "project" {
56+
provider = google-beta
57+
}
58+
59+
resource "google_gemini_release_channel_setting" "basic" {
60+
provider = google-beta
61+
release_channel_setting_id = "%{release_channel_setting_id}"
62+
location = "global"
63+
labels = {"my_key" = "my_value"}
64+
release_channel = "EXPERIMENTAL"
65+
}
66+
67+
resource "google_gemini_release_channel_setting_binding" "basic_binding" {
68+
provider = google-beta
69+
release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id
70+
setting_binding_id = "%{setting_binding_id}"
71+
location = "global"
72+
target = "projects/${data.google_project.project.number}"
73+
}
74+
`, context)
75+
}
76+
77+
func testAccGeminiReleaseChannelSettingBinding_update(context map[string]interface{}) string {
78+
return acctest.Nprintf(`
79+
data "google_project" "project" {
80+
provider = google-beta
81+
}
82+
83+
resource "google_gemini_release_channel_setting" "basic" {
84+
provider = google-beta
85+
release_channel_setting_id = "%{release_channel_setting_id}"
86+
location = "global"
87+
labels = {"my_key" = "my_value"}
88+
release_channel = "EXPERIMENTAL"
89+
}
90+
91+
resource "google_gemini_release_channel_setting_binding" "basic_binding" {
92+
provider = google-beta
93+
release_channel_setting_id = google_gemini_release_channel_setting.basic.release_channel_setting_id
94+
setting_binding_id = "%{setting_binding_id}"
95+
location = "global"
96+
target = "projects/${data.google_project.project.number}"
97+
labels = {"my_key" = "my_value"}
98+
product = "GEMINI_CODE_ASSIST"
99+
}
100+
`, context)
101+
}
102+
{{ end }}

mmv1/third_party/terraform/services/gemini/resource_gemini_release_channel_setting_test.go.tmpl

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package gemini_test
22
{{- if ne $.TargetVersionName "ga" }}
33

44
import (
5+
"fmt"
56
"testing"
67

78
"github.com/hashicorp/terraform-plugin-testing/helper/resource"
@@ -12,7 +13,7 @@ import (
1213
func TestAccGeminiReleaseChannelSetting_geminiReleaseChannelSettingBasicExample_update(t *testing.T) {
1314
t.Parallel()
1415
context := map[string]interface{}{
15-
"setting_id": "ls-tf1",
16+
"setting_id": fmt.Sprintf("tf-test-ls-%s", acctest.RandString(t, 10)),
1617
}
1718
acctest.VcrTest(t, resource.TestCase{
1819
PreCheck: func() { acctest.AccTestPreCheck(t) },
@@ -60,6 +61,7 @@ resource "google_gemini_release_channel_setting" "example" {
6061
provider = google-beta
6162
release_channel_setting_id = "%{setting_id}"
6263
location = "global"
64+
labels = {"my_key" = "my_value"}
6365
release_channel = "STABLE"
6466
}
6567
`, context)

0 commit comments

Comments
 (0)