@@ -627,6 +627,8 @@ func TestAccComputeInstance_internalIPv6PrefixLength(t *testing.T) {
627627 testAccCheckComputeInstanceExists (
628628 t , "google_compute_instance.foobar" , & instance ),
629629 testAccCheckComputeInstanceIpv6AccessConfigHasInternalIPv6 (& instance ),
630+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
631+ testAccComputeInstance_internalIpv6PrefixLength ("96" , instanceName )),
630632 ),
631633 },
632634 computeInstanceImportStep ("us-west2-a" , instanceName , []string {"allow_stopping_for_update" }),
@@ -662,6 +664,8 @@ func TestAccComputeInstance_PTRRecord(t *testing.T) {
662664 testAccCheckComputeInstanceExists (
663665 t , "google_compute_instance.foobar" , & instance ),
664666 testAccCheckComputeInstanceAccessConfigHasNatIP (& instance ),
667+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
668+ testAccComputeInstance_ip (ipName , instanceName )),
665669 ),
666670 },
667671 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"metadata.baz" , "metadata.foo" }),
@@ -840,6 +844,8 @@ func TestAccComputeInstance_rsaBootDiskEncryption(t *testing.T) {
840844 Config : testAccComputeInstance_rsaBootDiskEncryption (context ),
841845 Check : resource .ComposeTestCheckFunc (
842846 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
847+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
848+ testAccComputeInstance_rsaBootDiskEncryption (context )),
843849 ),
844850 },
845851 },
@@ -902,6 +908,8 @@ func TestAccComputeInstance_instanceEncryption(t *testing.T) {
902908 Config : testAccComputeInstance_instanceEncryption_SelfLinkServiceAccount (context_3 ),
903909 Check : resource .ComposeTestCheckFunc (
904910 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
911+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
912+ testAccComputeInstance_instanceEncryption_SelfLinkServiceAccount (context_3 )),
905913 ),
906914 },
907915 },
@@ -930,6 +938,8 @@ func TestAccComputeInstance_snapshot(t *testing.T) {
930938 Config : testAccComputeInstance_snapshot (context ), //create from snapshot
931939 Check : resource .ComposeTestCheckFunc (
932940 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
941+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
942+ testAccComputeInstance_snapshot (context )),
933943 ),
934944 },
935945 },
@@ -971,6 +981,8 @@ func TestAccComputeInstance_snapshotEncryption(t *testing.T) {
971981 Config : testAccComputeInstance_snapshotEncryption_RsaKey (context ),
972982 Check : resource .ComposeTestCheckFunc (
973983 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
984+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
985+ testAccComputeInstance_snapshotEncryption_RsaKey (context )),
974986 ),
975987 },
976988 },
@@ -1012,6 +1024,8 @@ func TestAccComputeInstance_imageEncryption(t *testing.T) {
10121024 Config : testAccComputeInstance_imageEncryption_RsaKey (context ),
10131025 Check : resource .ComposeTestCheckFunc (
10141026 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
1027+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
1028+ testAccComputeInstance_imageEncryption_RsaKey (context )),
10151029 ),
10161030 },
10171031 },
@@ -1037,6 +1051,8 @@ func TestAccComputeInstance_attachedDisk_RSAencryption(t *testing.T) {
10371051 Config : testAccComputeInstance_attachedDisk_RSAencryption (context ),
10381052 Check : resource .ComposeTestCheckFunc (
10391053 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
1054+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
1055+ testAccComputeInstance_attachedDisk_RSAencryption (context )),
10401056 ),
10411057 },
10421058 },
@@ -1806,6 +1822,8 @@ func TestAccComputeInstance_schedulingTerminationTime(t *testing.T) {
18061822 Check : resource .ComposeTestCheckFunc (
18071823 testAccCheckComputeInstanceExists (
18081824 t , "google_compute_instance.foobar" , & instance ),
1825+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
1826+ testAccComputeInstance_TerminationTimeDeleted (instanceName )),
18091827 ),
18101828 },
18111829 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"allow_stopping_for_update" }),
@@ -2208,6 +2226,8 @@ func TestAccComputeInstance_forceChangeMachineTypeManually(t *testing.T) {
22082226 Check : resource .ComposeTestCheckFunc (
22092227 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
22102228 testAccCheckComputeInstanceUpdateMachineType (t , "google_compute_instance.foobar" ),
2229+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2230+ testAccComputeInstance_basic (instanceName )),
22112231 ),
22122232 ExpectNonEmptyPlan : true ,
22132233 },
@@ -2316,6 +2336,8 @@ func TestAccComputeInstance_guestAcceleratorSkip(t *testing.T) {
23162336 Check : resource .ComposeTestCheckFunc (
23172337 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
23182338 testAccCheckComputeInstanceLacksGuestAccelerator (& instance ),
2339+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2340+ testAccComputeInstance_guestAccelerator (instanceName , 0 )),
23192341 ),
23202342 },
23212343 },
@@ -2408,6 +2430,8 @@ func TestAccComputeInstance_deletionProtectionExplicitTrueAndUpdateFalse(t *test
24082430 testAccCheckComputeInstanceExists (
24092431 t , "google_compute_instance.foobar" , & instance ),
24102432 testAccCheckComputeInstanceHasConfiguredDeletionProtection (& instance , false ),
2433+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2434+ testAccComputeInstance_basic_deletionProtectionFalse (instanceName )),
24112435 ),
24122436 },
24132437 },
@@ -2801,6 +2825,8 @@ func TestAccComputeInstance_desiredStatusSuspendedOnCreation(t *testing.T) {
28012825 Check : resource .ComposeTestCheckFunc (
28022826 testAccCheckComputeInstanceExists (t , "google_compute_instance.foobar" , & instance ),
28032827 testAccCheckComputeInstanceHasStatus (& instance , context_2 ["desired_status" ].(string )),
2828+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2829+ testAccComputeInstance_desiredStatusOnCreation (context_2 )),
28042830 ),
28052831 },
28062832 },
@@ -2933,6 +2959,8 @@ func TestAccComputeInstance_updateRunning_desiredStatusRunning_allowStoppingForU
29332959 t , "google_compute_instance.foobar" , & instance ),
29342960 testAccCheckComputeInstanceHasMachineType (& instance , "e2-standard-2" ),
29352961 testAccCheckComputeInstanceHasStatus (& instance , "RUNNING" ),
2962+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2963+ testAccComputeInstance_machineType_desiredStatus_allowStoppingForUpdate (instanceName , "e2-standard-2" , "RUNNING" , true )),
29362964 ),
29372965 },
29382966 },
@@ -2958,6 +2986,8 @@ func TestAccComputeInstance_updateRunning_desiredStatusNotSet_notAllowStoppingFo
29582986 testAccCheckComputeInstanceExists (
29592987 t , "google_compute_instance.foobar" , & instance ),
29602988 testAccCheckComputeInstanceHasStatus (& instance , "RUNNING" ),
2989+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
2990+ testAccComputeInstance_basic2 (instanceName )),
29612991 ),
29622992 },
29632993 {
@@ -2985,6 +3015,8 @@ func TestAccComputeInstance_updateRunning_desiredStatusRunning_notAllowStoppingF
29853015 testAccCheckComputeInstanceExists (
29863016 t , "google_compute_instance.foobar" , & instance ),
29873017 testAccCheckComputeInstanceHasStatus (& instance , "RUNNING" ),
3018+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3019+ testAccComputeInstance_basic2 (instanceName )),
29883020 ),
29893021 },
29903022 {
@@ -3055,6 +3087,8 @@ func TestAccComputeInstance_updateRunning_desiredStatusTerminated_notAllowStoppi
30553087 t , "google_compute_instance.foobar" , & instance ),
30563088 testAccCheckComputeInstanceHasMachineType (& instance , "e2-standard-2" ),
30573089 testAccCheckComputeInstanceHasStatus (& instance , "TERMINATED" ),
3090+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3091+ testAccComputeInstance_machineType_desiredStatus_allowStoppingForUpdate (instanceName , "e2-standard-2" , "TERMINATED" , false )),
30583092 ),
30593093 },
30603094 },
@@ -3137,6 +3171,8 @@ func TestAccComputeInstance_updateTerminated_desiredStatusTerminated_allowStoppi
31373171 t , "google_compute_instance.foobar" , & instance ),
31383172 testAccCheckComputeInstanceHasMachineType (& instance , "e2-standard-2" ),
31393173 testAccCheckComputeInstanceHasStatus (& instance , "TERMINATED" ),
3174+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3175+ testAccComputeInstance_machineType_desiredStatus_allowStoppingForUpdate (instanceName , "e2-standard-2" , "TERMINATED" , true )),
31403176 ),
31413177 },
31423178 },
@@ -3259,6 +3295,8 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_allowStoppingF
32593295 t , "google_compute_instance.foobar" , & instance ),
32603296 testAccCheckComputeInstanceHasMachineType (& instance , "e2-standard-2" ),
32613297 testAccCheckComputeInstanceHasStatus (& instance , "RUNNING" ),
3298+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3299+ testAccComputeInstance_machineType_desiredStatus_allowStoppingForUpdate (instanceName , "e2-standard-2" , "RUNNING" , true )),
32623300 ),
32633301 },
32643302 },
@@ -3299,6 +3337,8 @@ func TestAccComputeInstance_updateTerminated_desiredStatusRunning_notAllowStoppi
32993337 t , "google_compute_instance.foobar" , & instance ),
33003338 testAccCheckComputeInstanceHasMachineType (& instance , "e2-standard-2" ),
33013339 testAccCheckComputeInstanceHasStatus (& instance , "RUNNING" ),
3340+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3341+ testAccComputeInstance_machineType_desiredStatus_allowStoppingForUpdate (instanceName , "e2-standard-2" , "RUNNING" , false )),
33023342 ),
33033343 },
33043344 },
@@ -3559,6 +3599,8 @@ func TestAccComputeInstance_spotVM_update(t *testing.T) {
35593599 Check : resource .ComposeTestCheckFunc (
35603600 testAccCheckComputeInstanceExists (
35613601 t , "google_compute_instance.foobar" , & instance ),
3602+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3603+ testAccComputeInstance_spotVM (instanceName )),
35623604 ),
35633605 },
35643606 computeInstanceImportStep ("us-central1-a" , instanceName , []string {}),
@@ -3720,6 +3762,8 @@ func TestAccComputeInstance_standardVM_maxRunDuration_deleteTerminationAction(t
37203762 t , "google_compute_instance.foobar" , & instance ),
37213763 testAccCheckComputeInstanceTerminationAction (& instance , instanceTerminationAction ),
37223764 testAccCheckComputeInstanceMaxRunDuration (& instance , expectedMaxRunDuration ),
3765+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3766+ testAccComputeInstance_standardVM_maxRunDuration (instanceName , instanceTerminationAction )),
37233767 ),
37243768 },
37253769 computeInstanceImportStep ("us-central1-a" , instanceName , []string {}),
@@ -3755,6 +3799,8 @@ func TestAccComputeInstance_spotVM_maxRunDuration_update(t *testing.T) {
37553799 testAccCheckComputeInstanceExists (
37563800 t , "google_compute_instance.foobar" , & instance ),
37573801 testAccCheckComputeInstanceMaxRunDuration (& instance , expectedMaxRunDuration ),
3802+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3803+ testAccComputeInstance_spotVM_maxRunDuration (instanceName , "DELETE" )),
37583804 ),
37593805 },
37603806 computeInstanceImportStep ("us-central1-a" , instanceName , []string {}),
@@ -3820,6 +3866,8 @@ func TestAccComputeInstance_localSsdRecoveryTimeout_update(t *testing.T) {
38203866 testAccCheckComputeInstanceExists (
38213867 t , "google_compute_instance.foobar" , & instance ),
38223868 testAccCheckComputeInstanceLocalSsdRecoveryTimeout (& instance , expectedLocalSsdRecoveryTimeout ),
3869+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
3870+ testAccComputeInstance_localSsdRecoveryTimeout (instanceName )),
38233871 ),
38243872 },
38253873 computeInstanceImportStep ("us-central1-a" , instanceName , []string {}),
@@ -3988,6 +4036,8 @@ func TestAccComputeInstance_creationOnlyAttributionLabelConfiguredOnUpdate(t *te
39884036 t , "google_compute_instance.foobar" , & instance ),
39894037 testAccCheckComputeInstanceLabel (& instance , "user_label" , "bar" ),
39904038 testAccCheckComputeInstanceAttributionLabel (& instance , false ),
4039+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4040+ testAccComputeInstance_attributionLabelUpdate (instanceName , "true" , "CREATION_ONLY" )),
39914041 ),
39924042 },
39934043 },
@@ -4023,6 +4073,8 @@ func TestAccComputeInstance_proactiveAttributionLabel(t *testing.T) {
40234073 t , "google_compute_instance.foobar" , & instance ),
40244074 testAccCheckComputeInstanceLabel (& instance , "user_label" , "bar" ),
40254075 testAccCheckComputeInstanceAttributionLabel (& instance , true ),
4076+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4077+ testAccComputeInstance_attributionLabelUpdate (instanceName , "true" , "PROACTIVE" )),
40264078 ),
40274079 },
40284080 },
@@ -4118,8 +4170,16 @@ func TestAccComputeInstance_keyRevocationActionType(t *testing.T) {
41184170 testAccCheckComputeInstanceExists (
41194171 t , "google_compute_instance.foobar" , & instance ),
41204172 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "key_revocation_action_type" , "" ),
4173+ ),
4174+ },
4175+ {
4176+ Config : testAccComputeInstance_keyRevocationActionType (context_2 ),
4177+ Check : resource .ComposeTestCheckFunc (
4178+ testAccCheckComputeInstanceExists (
4179+ t , "google_compute_instance.foobar" , & instance ),
4180+ resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "key_revocation_action_type" , "STOP" ),
41214181 acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4122- testAccComputeInstance_keyRevocationActionType (context_3 )),
4182+ testAccComputeInstance_keyRevocationActionType (context_2 )),
41234183 ),
41244184 },
41254185 },
@@ -4195,6 +4255,8 @@ func TestAccComputeInstance_NetworkAttachment(t *testing.T) {
41954255 testAccCheckComputeInstanceExists (
41964256 t , "google_compute_instance.foobar" , & instance ),
41974257 testAccCheckComputeInstanceHasNetworkAttachment (& instance , fmt .Sprintf ("https://www.googleapis.com/compute/%s/%s" , providerVersion , fullFormNetworkAttachmentName )),
4258+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4259+ testAccComputeInstance_networkAttachment (context )),
41984260 ),
41994261 },
42004262 },
@@ -4225,6 +4287,10 @@ func TestAccComputeInstance_NetworkAttachmentUpdate(t *testing.T) {
42254287 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"allow_stopping_for_update" }),
42264288 {
42274289 Config : testAccComputeInstance_networkAttachmentUpdate (networkAttachmentSelflink1 , envRegion , suffix ),
4290+ Check : resource .ComposeTestCheckFunc (
4291+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4292+ testAccComputeInstance_networkAttachmentUpdate (networkAttachmentSelflink1 , envRegion , suffix )),
4293+ ),
42284294 },
42294295 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"allow_stopping_for_update" }),
42304296 },
@@ -4252,6 +4318,10 @@ func TestAccComputeInstance_NicStackTypeUpdate(t *testing.T) {
42524318 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"allow_stopping_for_update" }),
42534319 {
42544320 Config : testAccComputeInstance_nicStackTypeUpdate (suffix , envRegion , "IPV4_ONLY" , instanceName ),
4321+ Check : resource .ComposeTestCheckFunc (
4322+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4323+ testAccComputeInstance_nicStackTypeUpdate (suffix , envRegion , "IPV4_ONLY" , instanceName )),
4324+ ),
42554325 },
42564326 computeInstanceImportStep ("us-central1-a" , instanceName , []string {"allow_stopping_for_update" }),
42574327 },
@@ -4273,6 +4343,10 @@ func TestAccComputeInstance_NicStackType_IPV6(t *testing.T) {
42734343 Steps : []resource.TestStep {
42744344 {
42754345 Config : testAccComputeInstance_nicStackTypeUpdate_ipv6 (context ),
4346+ Check : resource .ComposeTestCheckFunc (
4347+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4348+ testAccComputeInstance_nicStackTypeUpdate_ipv6 (context )),
4349+ ),
42764350 },
42774351 },
42784352 })
@@ -4299,6 +4373,8 @@ func TestAccComputeInstance_guestOsFeatures(t *testing.T) {
42994373 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "boot_disk.0.guest_os_features.1" , "VIRTIO_SCSI_MULTIQUEUE" ),
43004374 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "boot_disk.0.guest_os_features.2" , "GVNIC" ),
43014375 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "boot_disk.0.guest_os_features.3" , "IDPF" ),
4376+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
4377+ testAccComputeInstance_guestOsFeatures (context_1 )),
43024378 ),
43034379 },
43044380 },
@@ -8749,7 +8825,8 @@ resource "google_compute_instance" "foobar" {
87498825 values = ["%[1]s"]
87508826 }
87518827 }
8752- }` , instanceName )
8828+ }
8829+ ` , instanceName )
87538830}
87548831
87558832func testAccComputeInstance_shieldedVmConfig (instance string , enableSecureBoot bool , enableVtpm bool , enableIntegrityMonitoring bool ) string {
@@ -9344,7 +9421,6 @@ resource "google_compute_resource_policy" "foo" {
93449421 collocation = "COLLOCATED"
93459422 }
93469423}
9347-
93489424` , instance , instance , suffix )
93499425}
93509426
@@ -10269,6 +10345,10 @@ func TestAccComputeInstance_bootDisk_storagePoolSpecified(t *testing.T) {
1026910345 Steps : []resource.TestStep {
1027010346 {
1027110347 Config : testAccComputeInstance_bootDisk_storagePoolSpecified (instanceName , storagePoolNameLong , envvar .GetTestZoneFromEnv ()),
10348+ Check : resource .ComposeTestCheckFunc (
10349+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
10350+ testAccComputeInstance_bootDisk_storagePoolSpecified (instanceName , storagePoolNameLong , envvar .GetTestZoneFromEnv ())),
10351+ ),
1027210352 },
1027310353 {
1027410354 ResourceName : "google_compute_instance.foobar" ,
@@ -10291,6 +10371,10 @@ func TestAccComputeInstance_bootDisk_storagePoolSpecified_nameOnly(t *testing.T)
1029110371 Steps : []resource.TestStep {
1029210372 {
1029310373 Config : testAccComputeInstance_bootDisk_storagePoolSpecified (instanceName , "tf-bootstrap-storage-pool-hyperdisk-balanced-basic-2" , envvar .GetTestZoneFromEnv ()),
10374+ Check : resource .ComposeTestCheckFunc (
10375+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
10376+ testAccComputeInstance_bootDisk_storagePoolSpecified (instanceName , "tf-bootstrap-storage-pool-hyperdisk-balanced-basic-2" , envvar .GetTestZoneFromEnv ())),
10377+ ),
1029410378 },
1029510379 {
1029610380 ResourceName : "google_compute_instance.foobar" ,
@@ -10355,6 +10439,8 @@ func TestAccComputeInstance_bootAndAttachedDisk_interface(t *testing.T) {
1035510439 Check : resource .ComposeTestCheckFunc (
1035610440 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "boot_disk.0.interface" , "SCSI" ),
1035710441 resource .TestCheckResourceAttr ("google_compute_instance.foobar" , "machine_type" , "n2-standard-8" ),
10442+ acctest .GetTestMetadataForTgc ("compute" , "google_compute_instance.foobar" ,
10443+ testAccComputeInstance_bootAndAttachedDisk_interface (instanceName2 , diskName2 , envvar .GetTestZoneFromEnv (), "n2-standard-8" , "SCSI" , true )),
1035810444 ),
1035910445 },
1036010446 //computeInstanceImportStep("us-central1-a", instanceName2, []string{"desired_status","allow_stopping_for_update"}),
@@ -10483,7 +10569,8 @@ resource "google_compute_instance" "foobar" {
1048310569 network_interface {
1048410570 network = "default"
1048510571 }
10486- }` , context )
10572+ }
10573+ ` , context )
1048710574}
1048810575
1048910576func testAccComputeInstance_nicStackTypeUpdate_ipv6 (context map [string ]interface {}) string {
0 commit comments