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 TestAccGeminiCodeToolsSettingBinding_update(t *testing.T) {
15
+ t.Parallel()
16
+
17
+ context := map[string]interface{}{
18
+ "code_tools_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: testAccGeminiCodeToolsSettingBinding_basic(context),
28
+ },
29
+ {
30
+ ResourceName: "google_gemini_code_tools_setting_binding.basic_binding",
31
+ ImportState: true,
32
+ ImportStateVerify: true,
33
+ ImportStateVerifyIgnore: []string{"labels", "location", "code_tools_setting_id", "terraform_labels"},
34
+ },
35
+ {
36
+ Config: testAccGeminiCodeToolsSettingBinding_update(context),
37
+ ConfigPlanChecks: resource.ConfigPlanChecks{
38
+ PreApply: []plancheck.PlanCheck{
39
+ plancheck.ExpectResourceAction("google_gemini_code_tools_setting_binding.basic_binding", plancheck.ResourceActionUpdate),
40
+ },
41
+ },
42
+ },
43
+ {
44
+ ResourceName: "google_gemini_code_tools_setting_binding.basic_binding",
45
+ ImportState: true,
46
+ ImportStateVerify: true,
47
+ ImportStateVerifyIgnore: []string{"labels", "location", "code_tools_setting_id", "terraform_labels"},
48
+ },
49
+ },
50
+ })
51
+ }
52
+
53
+ func testAccGeminiCodeToolsSettingBinding_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_code_tools_setting" "basic" {
60
+ provider = google-beta
61
+ code_tools_setting_id = "%{code_tools_setting_id}"
62
+ location = "global"
63
+ labels = {"my_key" = "my_value"}
64
+ enabled_tool {
65
+ handle = "my_handle"
66
+ tool = "my_tool"
67
+ account_connector = "my_con"
68
+ config {
69
+ key = "my_key"
70
+ value = "my_value"
71
+ }
72
+ uri_override = "my_uri_override"
73
+ }
74
+ }
75
+
76
+ resource "google_gemini_code_tools_setting_binding" "basic_binding" {
77
+ provider = google-beta
78
+ code_tools_setting_id = google_gemini_code_tools_setting.basic.code_tools_setting_id
79
+ setting_binding_id = "%{setting_binding_id}"
80
+ location = "global"
81
+ target = "projects/${data.google_project.project.number}"
82
+ }
83
+ `, context)
84
+ }
85
+
86
+ func testAccGeminiCodeToolsSettingBinding_update(context map[string]interface{}) string {
87
+ return acctest.Nprintf(`
88
+ data "google_project" "project" {
89
+ provider = google-beta
90
+ }
91
+
92
+ resource "google_gemini_code_tools_setting" "basic" {
93
+ provider = google-beta
94
+ code_tools_setting_id = "%{code_tools_setting_id}"
95
+ location = "global"
96
+ labels = {"my_key" = "my_value"}
97
+ enabled_tool {
98
+ handle = "my_handle"
99
+ tool = "my_tool"
100
+ account_connector = "my_con"
101
+ config {
102
+ key = "my_key"
103
+ value = "my_value"
104
+ }
105
+ uri_override = "my_uri_override"
106
+ }
107
+ }
108
+
109
+ resource "google_gemini_code_tools_setting_binding" "basic_binding" {
110
+ provider = google-beta
111
+ code_tools_setting_id = google_gemini_code_tools_setting.basic.code_tools_setting_id
112
+ setting_binding_id = "%{setting_binding_id}"
113
+ location = "global"
114
+ target = "projects/${data.google_project.project.number}"
115
+ labels = {"my_key" = "my_value"}
116
+ product = "GEMINI_CODE_ASSIST"
117
+ }
118
+ `, context)
119
+ }
120
+ {{ end }}
0 commit comments