@@ -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+
89165func TestAccAlloydbBackup_alloydbBackupFullTestExample (t * testing.T ) {
90166 acctest .SkipIfVcr (t )
91167 t .Parallel ()
0 commit comments