@@ -157,3 +157,52 @@ resource "google_compute_instant_snapshot" "foobar" {
157157}
158158` , context)
159159}
160+
161+ func TestAccComputeInstantSnapshot_resourceManagerTags(t *testing.T ) {
162+ t.Parallel ()
163+
164+ org := envvar.GetTestOrgFromEnv (t)
165+ suffix := acctest.RandString (t, 10)
166+ tagKeyResult := acctest.BootstrapSharedTestTagKeyDetails (t, " crm-instant-snapshots-tagkey" , " organizations/" +org, make(map[string]interface{}))
167+ sharedTagKey, _ := tagKeyResult[" shared_tag_key" ]
168+ tagValueResult := acctest.BootstrapSharedTestTagValueDetails (t, " crm-instant-snapshots-tagvalue" , sharedTagKey, org)
169+
170+ context := map[string]interface{}{
171+ " random_suffix" : suffix,
172+ " tag_key_id" : tagKeyResult[" name" ],
173+ " tag_value_id" : tagValueResult[" name" ],
174+ }
175+
176+ acctest.VcrTest (t, resource.TestCase {
177+ PreCheck: func() { acctest.AccTestPreCheck (t) },
178+ ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories (t),
179+ CheckDestroy: testAccCheckComputeInstantSnapshotDestroyProducer(t),
180+ Steps: []resource.TestStep {
181+ {
182+ Config: testAccComputeInstantSnapshot_resourceManagerTags(context),
183+ },
184+ },
185+ })
186+ }
187+
188+ func testAccComputeInstantSnapshot_resourceManagerTags(context map[string]interface{}) string {
189+ return acctest.Nprintf (`
190+ resource "google_compute_disk" "disk" {
191+ name = "tf-test-disk-%{random_suffix}"
192+ type = "pd-standard"
193+ zone = "us-central1-a"
194+ size = 10
195+ }
196+
197+ resource "google_compute_instant_snapshot" "foobar" {
198+ name = "tf-test-instant-snapshot-%{random_suffix}"
199+ source_disk = google_compute_disk.disk.self_link
200+ zone = google_compute_disk.disk.zone
201+ params {
202+ resource_manager_tags = {
203+ "%{tag_key_id}" = "%{tag_value_id}"
204+ }
205+ }
206+ }
207+ ` , context)
208+ }
0 commit comments