Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

id of instance templates now relies on the unique id of the resource #7358

Merged
merged 1 commit into from
Mar 28, 2023

Conversation

irsl
Copy link
Contributor

@irsl irsl commented Feb 27, 2023

This is a security improvement to prevent instance templates being replaced after an instance template is created and before it is used by another resource (e.g. MIG creation). It introduces the self_link_unique computed attribute for google_compute_instance_template's that can be used to prevent TOCTOU attacks when resources are created in an untrusted environment.

If this PR is for Terraform, I acknowledge that I have:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

compute: added output-only attribute `self_link_unique` id for `google_compute_instance_template` to point to the unique id of the resource (instead of its name). It is recommended to use `self_link_unique` for references over `self_link` and `id` for `google_compute_instance_template`

@irsl irsl requested a review from a team as a code owner February 27, 2023 11:52
@irsl irsl requested review from shuyama1 and removed request for a team February 27, 2023 11:52
@shuyama1
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 4 files changed, 6 insertions(+), 4 deletions(-))
Terraform Beta: Diff ( 4 files changed, 6 insertions(+), 4 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2473
Passed tests 2122
Skipped tests: 255
Failed tests: 96

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccComputeBackendService_withBackendAndMaxUtilization|TestAccComputeBackendService_withBackendAndIAP|TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript|TestAccComputeRegionAutoscaler_update|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeRegionBackendService_withBackendInternal|TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample|TestAccComputeRegionPerInstanceConfig_update|TestAccComputeRegionAutoscaler_scaleInControl|TestAccComputeRegionAutoscaler_scalingSchedule|TestAccComputeRegionAutoscaler_scaleDownControl|TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample|TestAccComputePerInstanceConfig_update|TestAccRegionInstanceGroupManager_distributionPolicy|TestAccRegionInstanceGroupManager_autoHealingPolicies|TestAccComputeInstanceTemplate_regionDisks|TestAccRegionInstanceGroupManager_versions|TestAccComputeInstanceTemplate_spot|TestAccComputeInstanceTemplate_disks|TestAccComputeInstanceTemplate_managedEnvoy|TestAccComputeInstanceTemplate_queueCount|TestAccComputeInstanceTemplate_networkIPAddress|TestAccRegionInstanceGroupManager_update|TestAccComputeInstanceTemplate_nictype_update|TestAccComputeInstanceTemplate_diskResourcePolicies|TestAccInstanceGroupManager_waitForStatus|TestAccComputeInstanceTemplate_withScratchDisk|TestAccRegionInstanceGroupManager_targetSizeZero|TestAccInstanceGroupManager_stateful|TestAccInstanceGroupManager_autoHealingPolicies|TestAccRegionInstanceGroupManager_basic|TestAccInstanceGroupManager_versions|TestAccInstanceGroupManager_update|TestAccComputeInstanceTemplate_enableDisplay|TestAccInstanceGroupManager_targetSizeZero|TestAccComputeInstanceTemplate_networkIP|TestAccComputeInstanceTemplate_AdvancedMachineFeatures|TestAccInstanceGroupManager_basic|TestAccComputeInstanceTemplate_networkTier|TestAccComputeInstanceFromTemplate_012_removableFields|TestAccComputeInstanceTemplate_IPv6|TestAccComputeInstanceFromTemplate_overrideScheduling|TestAccComputeInstanceTemplate_ConfidentialInstanceConfigMain|TestAccComputeInstanceFromTemplate_overrideScratchDisk|TestAccComputeInstanceFromTemplate_overrideAttachedDisk|TestAccComputeInstanceTemplate_shieldedVmConfig2|TestAccComputeInstanceTemplate_IP|TestAccComputeInstanceFromTemplate_overrideBootDisk|TestAccComputeInstanceTemplate_spot_maxRunDuration|TestAccComputeInstanceTemplate_preemptible|TestAccComputeInstanceFromTemplate_basic|TestAccComputeInstanceTemplate_imageShorthand|TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey|TestAccComputeInstanceTemplate_basic|TestAccComputeInstanceTemplate_shieldedVmConfig1|TestAccComputeInstanceTemplate_reservationAffinities|TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample|TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample|TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample|TestAccComputeRegionBackendService_withBackendMultiNic|TestAccComputeRegionBackendService_withBackendInternalManaged|TestAccComputeBackendService_withBackend|TestAccComputeInstanceTemplate_sourceImageEncryptionKey|TestAccComputeForwardingRule_update|TestAccComputeForwardingRule_forwardingRuleHttpLbExample|TestAccComputeAutoscaler_scaleInControlFixed|TestAccComputeAutoscaler_scalingSchedule|TestAccComputeInstanceTemplate_instanceResourcePolicies|TestAccComputeInstanceTemplate_soleTenantNodeAffinities|TestAccComputeAutoscaler_scaleInControl|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccComputeAutoscaler_scaleDownControl|TestAccComputeAutoscaler_multicondition|TestAccComputeAutoscaler_update|TestAccComputeAutoscaler_autoscalerBasicExample|TestAccComputeBackendService_withMaxConnectionsPerInstance|TestAccComputeBackendService_withMaxConnections|TestAccComputeAutoscaler_autoscalerSingleInstanceExample|TestAccComputeInstanceTemplate_EncryptKMS|TestAccComputeInstanceTemplate_minCpuPlatform|TestAccComputeGlobalForwardingRule_globalForwardingRuleInternalExample|TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample|TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample|TestAccComputeInstanceTemplate_guestAcceleratorSkip|TestAccComputeInstanceTemplate_guestAccelerator|TestAccComputeInstanceTemplate_secondaryAliasIpRange|TestAccComputeInstanceTemplate_primaryAliasIpRange|TestAccComputeInstanceTemplate_metadata_startup_script|TestAccComputeInstanceTemplate_subnet_auto|TestAccComputeInstanceTemplate_subnet_custom|TestAccInstanceTemplateDatasource_filter|TestAccInstanceTemplateDatasource_filter_mostRecent|TestAccInstanceTemplateDatasource_name|TestAccDataSourceGoogleComputeInstanceGroup_fromIGM|TestAccDataSourceGoogleComputeInstanceGroupManager|TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccComputeBackendService_withBackendAndMaxUtilization[Debug log]
TestAccComputeBackendService_withBackendAndIAP[Debug log]
TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript[Debug log]
TestAccComputeRegionAutoscaler_update[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccComputeRegionBackendService_withBackendInternal[Debug log]
TestAccComputeRegionPerInstanceConfig_update[Debug log]
TestAccComputeRegionAutoscaler_scaleInControl[Debug log]
TestAccComputeRegionAutoscaler_scalingSchedule[Debug log]
TestAccComputeRegionAutoscaler_scaleDownControl[Debug log]
TestAccComputePerInstanceConfig_update[Debug log]
TestAccRegionInstanceGroupManager_distributionPolicy[Debug log]
TestAccRegionInstanceGroupManager_autoHealingPolicies[Debug log]
TestAccComputeInstanceTemplate_regionDisks[Debug log]
TestAccRegionInstanceGroupManager_versions[Debug log]
TestAccComputeInstanceTemplate_spot[Debug log]
TestAccComputeInstanceTemplate_disks[Debug log]
TestAccComputeInstanceTemplate_managedEnvoy[Debug log]
TestAccComputeInstanceTemplate_queueCount[Debug log]
TestAccComputeInstanceTemplate_networkIPAddress[Debug log]
TestAccRegionInstanceGroupManager_update[Debug log]
TestAccComputeInstanceTemplate_nictype_update[Debug log]
TestAccComputeInstanceTemplate_diskResourcePolicies[Debug log]
TestAccInstanceGroupManager_waitForStatus[Debug log]
TestAccComputeInstanceTemplate_withScratchDisk[Debug log]
TestAccRegionInstanceGroupManager_targetSizeZero[Debug log]
TestAccInstanceGroupManager_stateful[Debug log]
TestAccInstanceGroupManager_autoHealingPolicies[Debug log]
TestAccRegionInstanceGroupManager_basic[Debug log]
TestAccInstanceGroupManager_versions[Debug log]
TestAccInstanceGroupManager_update[Debug log]
TestAccComputeInstanceTemplate_enableDisplay[Debug log]
TestAccInstanceGroupManager_targetSizeZero[Debug log]
TestAccComputeInstanceTemplate_networkIP[Debug log]
TestAccComputeInstanceTemplate_AdvancedMachineFeatures[Debug log]
TestAccInstanceGroupManager_basic[Debug log]
TestAccComputeInstanceTemplate_networkTier[Debug log]
TestAccComputeInstanceFromTemplate_012_removableFields[Debug log]
TestAccComputeInstanceTemplate_IPv6[Debug log]
TestAccComputeInstanceFromTemplate_overrideScheduling[Debug log]
TestAccComputeInstanceTemplate_ConfidentialInstanceConfigMain[Debug log]
TestAccComputeInstanceFromTemplate_overrideScratchDisk[Debug log]
TestAccComputeInstanceFromTemplate_overrideAttachedDisk[Debug log]
TestAccComputeInstanceTemplate_shieldedVmConfig2[Debug log]
TestAccComputeInstanceTemplate_IP[Debug log]
TestAccComputeInstanceFromTemplate_overrideBootDisk[Debug log]
TestAccComputeInstanceTemplate_spot_maxRunDuration[Debug log]
TestAccComputeInstanceTemplate_preemptible[Debug log]
TestAccComputeInstanceFromTemplate_basic[Debug log]
TestAccComputeInstanceTemplate_imageShorthand[Debug log]
TestAccComputeInstanceTemplate_basic[Debug log]
TestAccComputeInstanceTemplate_shieldedVmConfig1[Debug log]
TestAccComputeInstanceTemplate_reservationAffinities[Debug log]
TestAccComputeRegionBackendService_withBackendMultiNic[Debug log]
TestAccComputeRegionBackendService_withBackendInternalManaged[Debug log]
TestAccComputeBackendService_withBackend[Debug log]
TestAccComputeInstanceTemplate_sourceImageEncryptionKey[Debug log]
TestAccComputeForwardingRule_update[Debug log]
TestAccComputeAutoscaler_scaleInControlFixed[Debug log]
TestAccComputeAutoscaler_scalingSchedule[Debug log]
TestAccComputeInstanceTemplate_instanceResourcePolicies[Debug log]
TestAccComputeInstanceTemplate_soleTenantNodeAffinities[Debug log]
TestAccComputeAutoscaler_scaleInControl[Debug log]
TestAccComputeGlobalForwardingRule_internalLoadBalancing[Debug log]
TestAccComputeAutoscaler_scaleDownControl[Debug log]
TestAccComputeAutoscaler_multicondition[Debug log]
TestAccComputeAutoscaler_update[Debug log]
TestAccComputeBackendService_withMaxConnectionsPerInstance[Debug log]
TestAccComputeBackendService_withMaxConnections[Debug log]
TestAccComputeInstanceTemplate_EncryptKMS[Debug log]
TestAccComputeInstanceTemplate_minCpuPlatform[Debug log]
TestAccComputeInstanceTemplate_guestAcceleratorSkip[Debug log]
TestAccComputeInstanceTemplate_guestAccelerator[Debug log]
TestAccComputeInstanceTemplate_secondaryAliasIpRange[Debug log]
TestAccComputeInstanceTemplate_primaryAliasIpRange[Debug log]
TestAccComputeInstanceTemplate_metadata_startup_script[Debug log]
TestAccComputeInstanceTemplate_subnet_auto[Debug log]
TestAccComputeInstanceTemplate_subnet_custom[Debug log]
TestAccDataSourceGoogleComputeInstanceGroup_fromIGM[Debug log]

Tests failed during RECORDING mode:
TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample[Error message] [Debug log]
TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample[Error message] [Debug log]
TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey[Error message] [Debug log]
TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample[Error message] [Debug log]
TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample[Error message] [Debug log]
TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample[Error message] [Debug log]
TestAccComputeForwardingRule_forwardingRuleHttpLbExample[Error message] [Debug log]
TestAccComputeAutoscaler_autoscalerBasicExample[Error message] [Debug log]
TestAccComputeAutoscaler_autoscalerSingleInstanceExample[Error message] [Debug log]
TestAccComputeGlobalForwardingRule_globalForwardingRuleInternalExample[Error message] [Debug log]
TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample[Error message] [Debug log]
TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample[Error message] [Debug log]
TestAccInstanceTemplateDatasource_filter[Error message] [Debug log]
TestAccInstanceTemplateDatasource_filter_mostRecent[Error message] [Debug log]
TestAccInstanceTemplateDatasource_name[Error message] [Debug log]
TestAccDataSourceGoogleComputeInstanceGroupManager[Error message] [Debug log]
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@shuyama1
Copy link
Member

shuyama1 commented Mar 2, 2023

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 8 files changed, 135 insertions(+), 14 deletions(-))
Terraform Beta: Diff ( 8 files changed, 135 insertions(+), 14 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2485
Passed tests 2137
Skipped tests: 258
Failed tests: 90

Action taken

Triggering VCR tests in RECORDING mode for the tests that failed during VCR. Click here to see the failed tests
TestAccComputeBackendService_withBackendAndMaxUtilization|TestAccComputeBackendService_withBackendAndIAP|TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript|TestAccComputeRegionAutoscaler_update|TestAccComputeRegionBackendService_withBackendMultiNic|TestAccComputeRegionBackendService_withBackendInternalManaged|TestAccComputeRegionBackendService_withBackendInternal|TestAccRegionInstanceGroupManager_update|TestAccRegionInstanceGroupManager_targetSizeZero|TestAccRegionInstanceGroupManager_basic|TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample|TestAccComputePerInstanceConfig_statefulIps|TestAccComputePerInstanceConfig_update|TestAccComputeRegionPerInstanceConfig_statefulIps|TestAccComputeRegionPerInstanceConfig_update|TestAccComputeInstanceTemplate_guestAcceleratorSkip|TestAccComputeInstanceTemplate_guestAccelerator|TestAccComputeInstanceTemplate_secondaryAliasIpRange|TestAccInstanceGroupManager_update|TestAccComputeInstanceTemplate_spot_maxRunDuration|TestAccInstanceGroupManager_targetSizeZero|TestAccInstanceGroupManager_basic|TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey|TestAccComputeInstanceTemplate_sourceImageEncryptionKey|TestAccComputeInstanceTemplate_primaryAliasIpRange|TestAccComputeInstanceTemplate_metadata_startup_script|TestAccComputeInstanceTemplate_managedEnvoy|TestAccComputeInstanceFromTemplate_012_removableFields|TestAccComputeInstanceTemplate_subnet_custom|TestAccComputeInstanceTemplate_queueCount|TestAccComputeInstanceTemplate_nictype_update|TestAccComputeInstanceTemplate_diskResourcePolicies|TestAccComputeInstanceTemplate_subnet_auto|TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample|TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample|TestAccRegionInstanceGroupManager_distributionPolicy|TestAccRegionInstanceGroupManager_autoHealingPolicies|TestAccRegionInstanceGroupManager_versions|TestAccComputeInstanceTemplate_networkIPAddress|TestAccComputeInstanceTemplate_spot|TestAccComputeInstanceTemplate_AdvancedMachineFeatures|TestAccComputeAutoscaler_scalingSchedule|TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample|TestAccComputeInstanceTemplate_networkIP|TestAccComputeBackendService_withBackend|TestAccComputeRegionAutoscaler_scaleInControl|TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample|TestAccComputeInstanceFromTemplate_overrideScheduling|TestAccComputeAutoscaler_scaleDownControl|TestAccComputeInstanceTemplate_ConfidentialInstanceConfigMain|TestAccComputeInstanceFromTemplate_overrideScratchDisk|TestAccComputeAutoscaler_multicondition|TestAccComputeRegionAutoscaler_scalingSchedule|TestAccComputeAutoscaler_update|TestAccComputeInstanceFromTemplate_overrideAttachedDisk|TestAccComputeRegionAutoscaler_scaleDownControl|TestAccComputeBackendService_withMaxConnectionsPerInstance|TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample|TestAccComputeBackendService_withMaxConnections|TestAccComputeInstanceTemplate_IPv6|TestAccComputeAutoscaler_autoscalerBasicExample|TestAccComputeInstanceTemplate_shieldedVmConfig2|TestAccComputeInstanceTemplate_IP|TestAccComputeInstanceTemplate_shieldedVmConfig1|TestAccComputeInstanceTemplate_preemptible|TestAccComputeInstanceTemplate_imageShorthand|TestAccComputeInstanceTemplate_instanceResourcePolicies|TestAccComputeInstanceTemplate_basic|TestAccComputeAutoscaler_autoscalerSingleInstanceExample|TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample|TestAccComputeForwardingRule_forwardingRuleHttpLbExample|TestAccComputeGlobalForwardingRule_internalLoadBalancing|TestAccInstanceGroupManager_stateful|TestAccInstanceGroupManager_versions|TestAccComputeInstanceTemplate_EncryptKMS|TestAccComputeAutoscaler_scaleInControl|TestAccInstanceGroupManager_autoHealingPolicies|TestAccComputeInstanceTemplate_minCpuPlatform|TestAccComputeInstanceFromTemplate_basic|TestAccInstanceGroupManager_waitForStatus|TestAccComputeAutoscaler_scaleInControlFixed|TestAccComputeInstanceFromTemplate_overrideBootDisk|TestAccComputeGlobalForwardingRule_globalForwardingRuleInternalExample|TestAccComputeInstanceTemplate_reservationAffinities|TestAccDataSourceGoogleComputeInstanceGroup_fromIGM|TestAccDataSourceGoogleComputeInstanceGroupManager|TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample|TestAccInstanceTemplateDatasource_filter_mostRecent|TestAccInstanceTemplateDatasource_filter|TestAccInstanceTemplateDatasource_name

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccComputeBackendService_withBackendAndMaxUtilization[Debug log]
TestAccComputeBackendService_withBackendAndIAP[Debug log]
TestAccComputeInstanceFromTemplate_overrideMetadataDotStartupScript[Debug log]
TestAccComputeRegionAutoscaler_update[Debug log]
TestAccComputeRegionBackendService_withBackendMultiNic[Debug log]
TestAccComputeRegionBackendService_withBackendInternalManaged[Debug log]
TestAccComputeRegionBackendService_withBackendInternal[Debug log]
TestAccRegionInstanceGroupManager_update[Debug log]
TestAccRegionInstanceGroupManager_targetSizeZero[Debug log]
TestAccRegionInstanceGroupManager_basic[Debug log]
TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample[Debug log]
TestAccComputePerInstanceConfig_statefulIps[Debug log]
TestAccComputePerInstanceConfig_update[Debug log]
TestAccComputeRegionPerInstanceConfig_statefulIps[Debug log]
TestAccComputeRegionPerInstanceConfig_update[Debug log]
TestAccComputeInstanceTemplate_guestAcceleratorSkip[Debug log]
TestAccComputeInstanceTemplate_guestAccelerator[Debug log]
TestAccComputeInstanceTemplate_secondaryAliasIpRange[Debug log]
TestAccInstanceGroupManager_update[Debug log]
TestAccComputeInstanceTemplate_spot_maxRunDuration[Debug log]
TestAccInstanceGroupManager_targetSizeZero[Debug log]
TestAccInstanceGroupManager_basic[Debug log]
TestAccComputeInstanceTemplate_sourceImageEncryptionKey[Debug log]
TestAccComputeInstanceTemplate_primaryAliasIpRange[Debug log]
TestAccComputeInstanceTemplate_metadata_startup_script[Debug log]
TestAccComputeInstanceTemplate_managedEnvoy[Debug log]
TestAccComputeInstanceFromTemplate_012_removableFields[Debug log]
TestAccComputeInstanceTemplate_subnet_custom[Debug log]
TestAccComputeInstanceTemplate_queueCount[Debug log]
TestAccComputeInstanceTemplate_nictype_update[Debug log]
TestAccComputeInstanceTemplate_diskResourcePolicies[Debug log]
TestAccComputeInstanceTemplate_subnet_auto[Debug log]
TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample[Debug log]
TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample[Debug log]
TestAccRegionInstanceGroupManager_distributionPolicy[Debug log]
TestAccRegionInstanceGroupManager_autoHealingPolicies[Debug log]
TestAccRegionInstanceGroupManager_versions[Debug log]
TestAccComputeInstanceTemplate_networkIPAddress[Debug log]
TestAccComputeInstanceTemplate_spot[Debug log]
TestAccComputeInstanceTemplate_AdvancedMachineFeatures[Debug log]
TestAccComputeAutoscaler_scalingSchedule[Debug log]
TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample[Debug log]
TestAccComputeInstanceTemplate_networkIP[Debug log]
TestAccComputeBackendService_withBackend[Debug log]
TestAccComputeRegionAutoscaler_scaleInControl[Debug log]
TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample[Debug log]
TestAccComputeInstanceFromTemplate_overrideScheduling[Debug log]
TestAccComputeAutoscaler_scaleDownControl[Debug log]
TestAccComputeInstanceTemplate_ConfidentialInstanceConfigMain[Debug log]
TestAccComputeInstanceFromTemplate_overrideScratchDisk[Debug log]
TestAccComputeAutoscaler_multicondition[Debug log]
TestAccComputeRegionAutoscaler_scalingSchedule[Debug log]
TestAccComputeAutoscaler_update[Debug log]
TestAccComputeInstanceFromTemplate_overrideAttachedDisk[Debug log]
TestAccComputeRegionAutoscaler_scaleDownControl[Debug log]
TestAccComputeBackendService_withMaxConnectionsPerInstance[Debug log]
TestAccComputeRegionAutoscaler_regionAutoscalerBasicExample[Debug log]
TestAccComputeBackendService_withMaxConnections[Debug log]
TestAccComputeInstanceTemplate_IPv6[Debug log]
TestAccComputeAutoscaler_autoscalerBasicExample[Debug log]
TestAccComputeInstanceTemplate_shieldedVmConfig2[Debug log]
TestAccComputeInstanceTemplate_IP[Debug log]
TestAccComputeInstanceTemplate_shieldedVmConfig1[Debug log]
TestAccComputeInstanceTemplate_preemptible[Debug log]
TestAccComputeInstanceTemplate_imageShorthand[Debug log]
TestAccComputeInstanceTemplate_instanceResourcePolicies[Debug log]
TestAccComputeInstanceTemplate_basic[Debug log]
TestAccComputeAutoscaler_autoscalerSingleInstanceExample[Debug log]
TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample[Debug log]
TestAccComputeForwardingRule_forwardingRuleHttpLbExample[Debug log]
TestAccComputeGlobalForwardingRule_internalLoadBalancing[Debug log]
TestAccInstanceGroupManager_stateful[Debug log]
TestAccInstanceGroupManager_versions[Debug log]
TestAccComputeInstanceTemplate_EncryptKMS[Debug log]
TestAccComputeAutoscaler_scaleInControl[Debug log]
TestAccInstanceGroupManager_autoHealingPolicies[Debug log]
TestAccComputeInstanceTemplate_minCpuPlatform[Debug log]
TestAccComputeInstanceFromTemplate_basic[Debug log]
TestAccInstanceGroupManager_waitForStatus[Debug log]
TestAccComputeAutoscaler_scaleInControlFixed[Debug log]
TestAccComputeInstanceFromTemplate_overrideBootDisk[Debug log]
TestAccComputeGlobalForwardingRule_globalForwardingRuleInternalExample[Debug log]
TestAccComputeInstanceTemplate_reservationAffinities[Debug log]
TestAccDataSourceGoogleComputeInstanceGroup_fromIGM[Debug log]
TestAccDataSourceGoogleComputeInstanceGroupManager[Debug log]
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample[Debug log]
TestAccInstanceTemplateDatasource_filter_mostRecent[Debug log]
TestAccInstanceTemplateDatasource_filter[Debug log]
TestAccInstanceTemplateDatasource_name[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@shuyama1
Copy link
Member

shuyama1 commented Mar 8, 2023

The test failure may due to dangling resources in our test project from some previous tests (possibly test run in other PR). Would you mind modifying the test testAccComputeInstanceTemplate_sourceSnapshotEncryptionKey in the resource_compute_instance_template_test.go.erb file by changing the resource name of google_compute_disk to name = "tf-test-debian-disk-%s" at line 3253 and the resource name of google_compute_snapshot to name = "tf-test-my-snapshot-%s" at line 3261 with suffix as the pass in parameter. With this change, we can make sure that the resource is created with a randomized name and should not run into the resource already exists issue.

Also rebasing the PR should fix rbenv: version 3.2.0' is not installed` error.

Sorry about the extra work.

@irsl
Copy link
Contributor Author

irsl commented Mar 8, 2023

Thanks for the hints! I adjusted the PR as requested.

@shuyama1
Copy link
Member

shuyama1 commented Mar 8, 2023

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 8 files changed, 138 insertions(+), 17 deletions(-))
Terraform Beta: Diff ( 8 files changed, 138 insertions(+), 17 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2497
Passed tests 2231
Skipped tests: 262
Affected tests: 4

Action taken

Found 4 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstanceTemplate_maintenance_interval|TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey|TestAccCloudRunV2Job_cloudrunv2JobFullUpdate

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccComputeInstanceTemplate_maintenance_interval[Debug log]
TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey[Debug log]
TestAccCloudRunV2Job_cloudrunv2JobFullUpdate[Debug log]

All tests passed
View the build log or the debug log for each test

@irsl
Copy link
Contributor Author

irsl commented Mar 13, 2023

Hi Shuya!
Thanks for the pointers, the tests are finally all green. What is the next step? Please let me know if I can assist with anything.
Cheers,
Imre

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall! Only one small question. Also, would you mind rebasing the PR? Thanks you so much for the work!

Just want to make sure do we know that if this change will affect existing resource? Have you tested it locally?

@shuyama1
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 8 files changed, 139 insertions(+), 15 deletions(-))
Terraform Beta: Diff ( 8 files changed, 139 insertions(+), 15 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2501
Passed tests 2232
Skipped tests: 263
Affected tests: 6

Action taken

Found 6 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey|TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample|TestAccComposerEnvironment_withEncryptionConfigComposer2|TestAccDataSourceGoogleComputeInstanceGroupManager|TestAccDataSourceDnsManagedZone_basic

Get to know how VCR tests work

@rileykarson
Copy link
Member

I'm not sure we can make this change in 4.X, id changes are breaking changes as long as the id value can be used for references, which is true with this one. While the change covers common reference points with DSFs, it's possible to reference fields in arbitrary locations as well as to mix provider versions between google and google-beta, or across environments using https://developer.hashicorp.com/terraform/language/state/remote-state-data.

Adding a new attribute field and modifying examples to use that one, as well as adding a note to avoid using id in the documentation would be fine- changing the actual format of the value isn't, though. We can't deprecate the id field to prompt a migration as it's a system field, either.

We can change the id value in 5.0.0, set for September 15th: https://github.com/hashicorp/terraform-provider-google/milestone/89. If we make the backwards compatible changes that are possible now in this PR- adding the DSF, adding a new output field, updating documentation/examples- we can file an issue to make the migration of id in 5.0.0.

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample[Debug log]
TestAccComposerEnvironment_withEncryptionConfigComposer2[Debug log]
TestAccDataSourceGoogleComputeInstanceGroupManager[Debug log]

Tests failed during RECORDING mode:
TestAccComputeInstanceTemplate_sourceSnapshotEncryptionKey[Error message] [Debug log]
TestAccDataSourceDnsManagedZone_basic[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@irsl
Copy link
Contributor Author

irsl commented Mar 17, 2023

Hi @rileykarson,

Unfortunately this is somewhat more complicated. As one of my early attempts, I did try adding a new field to expose the unique id of the instance template. The problem is, even if you create a MIG with a unique id based instance template reference, Google APIs return the MIG with the name based instance template.

Like here:

POST /compute/beta/projects/imre-test-external/regions/us-central1/instanceGroupManagers?alt=json&prettyPrint=false HTTP/1.1

{
...
 "name": "tf-test-rbs-rigmaz2sjbi4oe",
 "versions": [
  {
   "instanceTemplate": "projects/imre-test-external/global/instanceTemplates/4309589837457938607",
   "name": "primary",
   "targetSize": {}
  }
 ]
}

When Terraform reads it back:

GET /compute/beta/projects/imre-test-external/regions/us-central1/instanceGroupManagers/tf-test-rbs-rigmaz2sjbi4oe?alt=json&prettyPrint=false HTTP/1.1

{
 "kind": "compute#instanceGroupManager",
 "id": "6524120918540703906",
 "versions": [
  {
   "name": "primary",
   "instanceTemplate": "https://www.googleapis.com/compute/beta/projects/imre-test-external/global/instanceTemplates/template-tf-test-region-serviceaz2sjbi4oe",
   "targetSize": {
    "calculated": 1
   }
  }
 ],

Then, Terraform complains "After applying this test step, the plan was not empty." as it thinks the MIG has changed.

This means, adding a new field alone is not enough; the comparison logic is to be adjusted as well.

What is a DSF? :$

Instead of adding a brand new field (and confusing users which of the 3 to use), can we make this with changing the structure of self-link only? In other words, do you consider changing self-links as breaking change as well?

@rileykarson
Copy link
Member

rileykarson commented Mar 17, 2023

A DSF is a "DiffSuppressFunc", a change to the comparison logic. It allows you to define a rule to let Terraform preserve the value stored in state rather than than use the value written in config. For example- if an API returned "FOO" and the user had written "bar", and those were equivalent. compareSelfLinkRelativePathsIgnoreParams in your change is one of them!

The problem is, even if you create a MIG with a unique id based instance template reference, Google APIs return the MIG with the name based instance template

That should cause problems with the current implementation as well, I think? It's almost certainly gonna have a nonobvious interaction going on based on DSFs working as described above, compareSelfLinkRelativePathsIgnoreParams will mean that unique ids only work at creation time or when the template's name is changed, never when updating the same template, since we'll use the stored value from the API over the returned value.

In other words, do you consider changing self-links as breaking change as well?

Yeah- changing an output value's format is generally a breaking change. This is because a user using it as a reference- including across provider versions / configurations- would be impacted. If there was zero impact to an existing config it'd be fine, but this change will definitely have one.

@shuyama1
Copy link
Member

TestAccDataSourceDnsManagedZone_basic failure is unrelated. No need to worry about it and sorry for the noise. Thanks for the refactoring. Start reviewing.

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM! Only a couple of small comments. Thanks for including detailed testing!

@shuyama1
Copy link
Member

/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 14 files changed, 444 insertions(+), 27 deletions(-))
Terraform Beta: Diff ( 14 files changed, 444 insertions(+), 27 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2526
Passed tests 2255
Skipped tests: 264
Affected tests: 7

Action taken

Found 7 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccNetworkServicesGateway_update|TestAccFirebaserulesRelease_BasicRelease|TestAccComputeInstanceFromTemplate_self_link_unique|TestAccComputeInstanceTemplate_with18TbScratchDisk|TestAccInstanceTemplateDatasource_self_link_unique|TestAccDataSourceGoogleCloudAssetResourcesSearchAll_basic|TestAccDataSourceDnsManagedZone_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccNetworkServicesGateway_update[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccComputeInstanceFromTemplate_self_link_unique[Debug log]
TestAccComputeInstanceTemplate_with18TbScratchDisk[Debug log]
TestAccInstanceTemplateDatasource_self_link_unique[Debug log]

Tests failed during RECORDING mode:
TestAccDataSourceGoogleCloudAssetResourcesSearchAll_basic[Error message] [Debug log]
TestAccDataSourceDnsManagedZone_basic[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

@shuyama1
Copy link
Member

/gcbrun To kick off VCR replaying to check if cassettes are recorded correctly

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Would you mind resolving file conflicts? Thanks!

…ore a follow-up operation (e.g. MIG creation) is started.
@irsl
Copy link
Contributor Author

irsl commented Mar 28, 2023

I just rebased this change again. Thanks!

@shuyama1
Copy link
Member

Thank you!
/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 14 files changed, 443 insertions(+), 28 deletions(-))
Terraform Beta: Diff ( 14 files changed, 443 insertions(+), 28 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2572
Passed tests 2274
Skipped tests: 267
Affected tests: 31

Action taken

Found 31 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample|TestAccNetworkServicesGateway_update|TestAccFrameworkProviderBasePath_setBasePath|TestAccFrameworkProviderMeta_setModuleName|TestAccComputeRegionPerInstanceConfig_statefulIps|TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample|TestAccComputeInstanceTemplate_subnet_custom|TestAccComputeInstanceTemplate_subnet_auto|TestAccComputeInstanceFromRegionTemplate_basic|TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample|TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample|TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample|TestAccComputeInstanceFromTemplate_self_link_unique|TestAccComputeInstanceTemplate_IPv6|TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample|TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccInstanceGroupManager_stateful|TestAccComputeInstanceTemplate_secondaryAliasIpRange|TestAccInstanceTemplateDatasource_self_link_unique|TestAccComputeRegionBackendService_withBackendMultiNic|TestAccCloudRunV2Job_cloudrunv2JobFullUpdate|TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample|TestAccComposerEnvironment_withEncryptionConfigComposer2|TestAccComposerEnvironment_withEncryptionConfigComposer1|TestAccComputePerInstanceConfig_statefulIps|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDNSKeys_basic|TestAccDataSourceDNSKeys_noDnsSec|TestAccDataSourceDnsManagedZone_basic|TestAccComputeForwardingRule_forwardingRuleHttpLbExample

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccWorkstationsWorkstationConfig_workstationConfigEncryptionKeyExample[Debug log]
TestAccNetworkServicesGateway_update[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccComputeRegionPerInstanceConfig_statefulIps[Debug log]
TestAccComputeRegionBackendService_regionBackendServiceBalancingModeExample[Debug log]
TestAccComputeInstanceTemplate_subnet_custom[Debug log]
TestAccComputeInstanceTemplate_subnet_auto[Debug log]
TestAccComputeInstanceFromRegionTemplate_basic[Debug log]
TestAccComputeForwardingRule_internalTcpUdpLbWithMigBackendExample[Debug log]
TestAccComputeForwardingRule_internalHttpLbWithMigBackendExample[Debug log]
TestAccComputeInstanceFromTemplate_self_link_unique[Debug log]
TestAccComputeInstanceTemplate_IPv6[Debug log]
TestAccComputeGlobalForwardingRule_externalHttpLbMigBackendCustomHeaderExample[Debug log]
TestAccComputeGlobalForwardingRule_externalTcpProxyLbMigBackendExample[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccInstanceGroupManager_stateful[Debug log]
TestAccComputeInstanceTemplate_secondaryAliasIpRange[Debug log]
TestAccInstanceTemplateDatasource_self_link_unique[Debug log]
TestAccComputeRegionBackendService_withBackendMultiNic[Debug log]
TestAccBigtableAppProfile_bigtableAppProfileMulticlusterExample[Debug log]
TestAccComputePerInstanceConfig_statefulIps[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccDataSourceDNSKeys_basic[Debug log]
TestAccDataSourceDNSKeys_noDnsSec[Debug log]
TestAccDataSourceDnsManagedZone_basic[Debug log]
TestAccComputeForwardingRule_forwardingRuleHttpLbExample[Debug log]

Tests failed during RECORDING mode:
TestAccCloudRunV2Job_cloudrunv2JobFullUpdate[Error message] [Debug log]
TestAccComposerEnvironment_withEncryptionConfigComposer2[Error message] [Debug log]
TestAccComposerEnvironment_withEncryptionConfigComposer1[Error message] [Debug log]

Several tests got terminated during RECORDING mode.
Please fix these to complete your PR
View the build log or the debug log for each test

@shuyama1
Copy link
Member

clean up unneeded cassettes
/gcbrun

@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 14 files changed, 443 insertions(+), 28 deletions(-))
Terraform Beta: Diff ( 14 files changed, 443 insertions(+), 28 deletions(-))
TF Validator: Diff ( 2 files changed, 3 insertions(+), 3 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 2572
Passed tests 2292
Skipped tests: 267
Affected tests: 13

Action taken

Found 13 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample|TestAccComposerEnvironment_withEncryptionConfigComposer2|TestAccComputeInstanceFromTemplate_self_link_unique|TestAccComputeInstanceFromRegionTemplate_basic|TestAccFrameworkProviderMeta_setModuleName|TestAccFrameworkProviderBasePath_setBasePath|TestAccInstanceTemplateDatasource_self_link_unique|TestAccDataSourceGoogleFirebaseAppleAppConfig|TestAccFirebaserulesRelease_BasicRelease|TestAccDataSourceDnsManagedZone_basic|TestAccDataSourceDNSKeys_noDnsSec|TestAccDataSourceDnsRecordSet_basic|TestAccDataSourceDNSKeys_basic

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

Tests passed during RECORDING mode:
TestAccComputeForwardingRule_forwardingRuleRegionalHttpXlbExample[Debug log]
TestAccComputeInstanceFromTemplate_self_link_unique[Debug log]
TestAccComputeInstanceFromRegionTemplate_basic[Debug log]
TestAccFrameworkProviderMeta_setModuleName[Debug log]
TestAccFrameworkProviderBasePath_setBasePath[Debug log]
TestAccInstanceTemplateDatasource_self_link_unique[Debug log]
TestAccDataSourceGoogleFirebaseAppleAppConfig[Debug log]
TestAccFirebaserulesRelease_BasicRelease[Debug log]
TestAccDataSourceDnsManagedZone_basic[Debug log]
TestAccDataSourceDNSKeys_noDnsSec[Debug log]
TestAccDataSourceDnsRecordSet_basic[Debug log]
TestAccDataSourceDNSKeys_basic[Debug log]

Tests failed during RECORDING mode:
TestAccComposerEnvironment_withEncryptionConfigComposer2[Error message] [Debug log]

Please fix these to complete your PR
View the build log or the debug log for each test

Copy link
Member

@shuyama1 shuyama1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants