Skip to content

Commit f6fa578

Browse files
alloydb: make psc_instance_config O+C in google_alloydb_instance (#11444) (#19143)
[upstream:69a0316490e4e808ab8302a864decc238ba00b81] Signed-off-by: Modular Magician <[email protected]>
1 parent 3a3492a commit f6fa578

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed

.changelog/11444.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
alloydb: fixed a permadiff on `psc_instance_config` in `google_alloydb_instance` resource
3+
```

google/services/alloydb/resource_alloydb_instance.go

+1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ the same instance.`,
217217
},
218218
"psc_instance_config": {
219219
Type: schema.TypeList,
220+
Computed: true,
220221
Optional: true,
221222
Description: `Configuration for Private Service Connect (PSC) for the instance.`,
222223
MaxItems: 1,

google/services/alloydb/resource_alloydb_instance_generated_test.go

+51
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,57 @@ data "google_compute_network" "default" {
167167
`, context)
168168
}
169169

170+
func TestAccAlloydbInstance_alloydbInstancePscTestExample(t *testing.T) {
171+
t.Parallel()
172+
173+
context := map[string]interface{}{
174+
"random_suffix": acctest.RandString(t, 10),
175+
}
176+
177+
acctest.VcrTest(t, resource.TestCase{
178+
PreCheck: func() { acctest.AccTestPreCheck(t) },
179+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
180+
CheckDestroy: testAccCheckAlloydbInstanceDestroyProducer(t),
181+
Steps: []resource.TestStep{
182+
{
183+
Config: testAccAlloydbInstance_alloydbInstancePscTestExample(context),
184+
},
185+
{
186+
ResourceName: "google_alloydb_instance.default",
187+
ImportState: true,
188+
ImportStateVerify: true,
189+
ImportStateVerifyIgnore: []string{"annotations", "cluster", "display_name", "instance_id", "labels", "reconciling", "terraform_labels", "update_time"},
190+
},
191+
},
192+
})
193+
}
194+
195+
func testAccAlloydbInstance_alloydbInstancePscTestExample(context map[string]interface{}) string {
196+
return acctest.Nprintf(`
197+
resource "google_alloydb_instance" "default" {
198+
cluster = google_alloydb_cluster.default.name
199+
instance_id = "tf-test-alloydb-instance%{random_suffix}"
200+
instance_type = "PRIMARY"
201+
202+
machine_config {
203+
cpu_count = 2
204+
}
205+
}
206+
207+
resource "google_alloydb_cluster" "default" {
208+
cluster_id = "tf-test-alloydb-cluster%{random_suffix}"
209+
location = "us-central1"
210+
211+
initial_user {
212+
password = "tf-test-alloydb-cluster%{random_suffix}"
213+
}
214+
psc_config {
215+
psc_enabled = true
216+
}
217+
}
218+
`, context)
219+
}
220+
170221
func testAccCheckAlloydbInstanceDestroyProducer(t *testing.T) func(s *terraform.State) error {
171222
return func(s *terraform.State) error {
172223
for name, rs := range s.RootModule().Resources {

0 commit comments

Comments
 (0)