Skip to content

Commit 803b5f5

Browse files
alloydb: re-enabled VCR for TestAccAlloydb* tests (#12227) (#20162)
[upstream:05cac2e2ab98a4cd96aa650d4c4442e25ac656b7] Signed-off-by: Modular Magician <[email protected]>
1 parent 66498f4 commit 803b5f5

File tree

4 files changed

+84
-5
lines changed

4 files changed

+84
-5
lines changed

.changelog/12227.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google/services/alloydb/resource_alloydb_backup_generated_test.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,82 @@ data "google_compute_network" "default" {
8686
`, context)
8787
}
8888

89+
func TestAccAlloydbBackup_alloydbBackupFullExample(t *testing.T) {
90+
t.Parallel()
91+
92+
context := map[string]interface{}{
93+
"random_suffix": acctest.RandString(t, 10),
94+
}
95+
96+
acctest.VcrTest(t, resource.TestCase{
97+
PreCheck: func() { acctest.AccTestPreCheck(t) },
98+
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t),
99+
CheckDestroy: testAccCheckAlloydbBackupDestroyProducer(t),
100+
Steps: []resource.TestStep{
101+
{
102+
Config: testAccAlloydbBackup_alloydbBackupFullExample(context),
103+
},
104+
{
105+
ResourceName: "google_alloydb_backup.default",
106+
ImportState: true,
107+
ImportStateVerify: true,
108+
ImportStateVerifyIgnore: []string{"annotations", "backup_id", "labels", "location", "reconciling", "terraform_labels", "update_time"},
109+
},
110+
},
111+
})
112+
}
113+
114+
func testAccAlloydbBackup_alloydbBackupFullExample(context map[string]interface{}) string {
115+
return acctest.Nprintf(`
116+
resource "google_alloydb_backup" "default" {
117+
location = "us-central1"
118+
backup_id = "tf-test-alloydb-backup%{random_suffix}"
119+
cluster_name = google_alloydb_cluster.default.name
120+
121+
description = "example description"
122+
type = "ON_DEMAND"
123+
labels = {
124+
"label" = "key"
125+
}
126+
depends_on = [google_alloydb_instance.default]
127+
}
128+
129+
resource "google_alloydb_cluster" "default" {
130+
cluster_id = "tf-test-alloydb-cluster%{random_suffix}"
131+
location = "us-central1"
132+
network_config {
133+
network = google_compute_network.default.id
134+
}
135+
}
136+
137+
resource "google_alloydb_instance" "default" {
138+
cluster = google_alloydb_cluster.default.name
139+
instance_id = "tf-test-alloydb-instance%{random_suffix}"
140+
instance_type = "PRIMARY"
141+
142+
depends_on = [google_service_networking_connection.vpc_connection]
143+
}
144+
145+
resource "google_compute_global_address" "private_ip_alloc" {
146+
name = "tf-test-alloydb-cluster%{random_suffix}"
147+
address_type = "INTERNAL"
148+
purpose = "VPC_PEERING"
149+
prefix_length = 16
150+
network = google_compute_network.default.id
151+
}
152+
153+
resource "google_service_networking_connection" "vpc_connection" {
154+
network = google_compute_network.default.id
155+
service = "servicenetworking.googleapis.com"
156+
reserved_peering_ranges = [google_compute_global_address.private_ip_alloc.name]
157+
}
158+
159+
resource "google_compute_network" "default" {
160+
name = "tf-test-alloydb-network%{random_suffix}"
161+
}
162+
`, context)
163+
}
164+
89165
func TestAccAlloydbBackup_alloydbBackupFullTestExample(t *testing.T) {
90166
acctest.SkipIfVcr(t)
91167
t.Parallel()

google/services/alloydb/resource_alloydb_secondary_cluster_test.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
// The cluster creation should succeed with minimal number of arguments
1414
func TestAccAlloydbCluster_secondaryClusterMandatoryFields(t *testing.T) {
1515
t.Parallel()
16-
// https://github.com/hashicorp/terraform-provider-google/issues/16231
17-
acctest.SkipIfVcr(t)
1816
context := map[string]interface{}{
1917
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydbinstance-network-config-1"),
2018
"random_suffix": acctest.RandString(t, 10),
@@ -154,9 +152,6 @@ data "google_compute_network" "default" {
154152
func TestAccAlloydbCluster_secondaryClusterDefinedSecondaryConfigButMissingClusterTypeSecondary(t *testing.T) {
155153
t.Parallel()
156154

157-
// Unskip in https://github.com/hashicorp/terraform-provider-google/issues/16231
158-
acctest.SkipIfVcr(t)
159-
160155
context := map[string]interface{}{
161156
"network_name": acctest.BootstrapSharedServiceNetworkingConnection(t, "alloydbinstance-network-config-1"),
162157
"random_suffix": acctest.RandString(t, 10),

website/docs/r/alloydb_backup.html.markdown

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ resource "google_compute_network" "default" {
7474
name = "alloydb-network"
7575
}
7676
```
77+
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
78+
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md&cloudshell_working_dir=alloydb_backup_full&open_in_editor=main.tf" target="_blank">
79+
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
80+
</a>
81+
</div>
7782
## Example Usage - Alloydb Backup Full
7883

7984

0 commit comments

Comments
 (0)