Skip to content

Compute: Add support for FLEX_START and RESERVATION_BOUND provisioning model#16750

Merged
ScottSuarez merged 5 commits intoGoogleCloudPlatform:mainfrom
MihajloLinic:main
Mar 24, 2026
Merged

Compute: Add support for FLEX_START and RESERVATION_BOUND provisioning model#16750
ScottSuarez merged 5 commits intoGoogleCloudPlatform:mainfrom
MihajloLinic:main

Conversation

@MihajloLinic
Copy link
Copy Markdown
Contributor

@MihajloLinic MihajloLinic commented Mar 18, 2026

compute: added `FLEX_START` and `RESERVATION_BOUND` support to `google_compute_instance`, `google_compute_instance_template`, and `google_compute_region_instance_template`

This PR adds support for the FLEX_START and RESERVATION_BOUND provisioning models to google_compute_instance, google_compute_instance_template, and google_compute_region_instance_template.

FLEX_START is a VM scheduling option in Google Cloud Compute Engine (part of the Dynamic Workload Scheduler) that allows flexible start times for VM instances, enabling cost optimization by letting Google schedule VM creation within a 24-hour time window. It is specifically designed for accelerator-optimized workloads (GPUs/TPUs).

RESERVATION_BOUND is a VM scheduling option that binds an instance to a specific reservation. When set, the instance will only consume capacity from the targeted reservation (configured via reservation_affinity). This is used with Calendar Reservations (Future Reservations) in the Dynamic Workload Scheduler, where GPU/TPU capacity is pre-booked for a specific time window and delivered as a standard reservation that instances can then target.

Changes

  • Schema Updates: Added FLEX_START and RESERVATION_BOUND as valid values for provisioning_model in the scheduling block of instances and instance templates. Updated field descriptions and validation logic.
  • TGC Support: Updated Terraform Google Conversion (TGC) logic to ensure FLEX_START and RESERVATION_BOUND are correctly handled during resource conversion.
  • Documentation: Updated the resource and data source documentation for instances and templates to include FLEX_START (with its required companion fields like instance_termination_action and max_run_duration) and RESERVATION_BOUND (with its companion reservation_affinity block).
  • Tests: Added comprehensive acceptance tests for both provisioning models across all affected resources:
    • TestAccComputeInstance_flexStart, TestAccComputeInstanceTemplate_flexStart, TestAccComputeRegionInstanceTemplate_flexStart
    • TestAccComputeInstance_reservationBound, TestAccComputeInstanceTemplate_reservationBound, TestAccComputeRegionInstanceTemplate_reservationBound

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Mar 18, 2026
@google-cla
Copy link
Copy Markdown

google-cla bot commented Mar 18, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot requested a review from ScottSuarez March 18, 2026 12:33
@github-actions
Copy link
Copy Markdown

Googlers: For automatic test runs see go/terraform-auto-test-runs.

@ScottSuarez, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician modular-magician added service/compute-instances and removed awaiting-approval Pull requests that need reviewer's approval to run presubmit tests labels Mar 18, 2026
@modular-magician
Copy link
Copy Markdown
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.

google provider: Diff ( 12 files changed, 228 insertions(+), 12 deletions(-))
google-beta provider: Diff ( 12 files changed, 228 insertions(+), 12 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 2 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 1389
Passed tests: 1296
Skipped tests: 90
Affected tests: 3

Click here to see the affected service packages
  • compute

Action taken

Found 3 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccComputeInstanceTemplate_flexStart
  • TestAccComputeInstance_flexStart
  • TestAccComputeRegionInstanceTemplate_flexStart

Get to know how VCR tests work

@modular-magician
Copy link
Copy Markdown
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccComputeInstanceTemplate_flexStart [Debug log]
TestAccComputeInstance_flexStart [Debug log]
TestAccComputeRegionInstanceTemplate_flexStart [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🟢 All tests passed!

View the build log or the debug log for each test

Copy link
Copy Markdown
Contributor

@ScottSuarez ScottSuarez left a comment

Choose a reason for hiding this comment

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

Can you test what would happen if a user explicitly sets empty string. I think since w are migrating this from another type to essentially an enum we would need to support empty string in the permuations.

@modular-magician modular-magician added the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Mar 19, 2026
@github-actions github-actions bot requested a review from ScottSuarez March 19, 2026 16:34
@MihajloLinic MihajloLinic changed the title Compute: Add support for FLEX_START provisioning model Compute: Add support for FLEX_START and RESERVATION_BOUND provisioning model Mar 19, 2026
@MihajloLinic
Copy link
Copy Markdown
Contributor Author

I expanded the scope to include RESERVATION_BOUND option too, implemented in same way the FLEX_START was. I needed them to connect to provision VMs through Coder. I will test empty string after I make sure RESERVATION_BOUND works through Coder

@MihajloLinic
Copy link
Copy Markdown
Contributor Author

Made "" pass validation too for backwards compatibility, GCP API will just treat it as standard same as before

@modular-magician modular-magician removed the awaiting-approval Pull requests that need reviewer's approval to run presubmit tests label Mar 23, 2026
@modular-magician
Copy link
Copy Markdown
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.

google provider: Diff ( 12 files changed, 641 insertions(+), 12 deletions(-))
google-beta provider: Diff ( 12 files changed, 641 insertions(+), 12 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 2 insertions(+), 1 deletion(-))

@modular-magician
Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 1406
Passed tests: 1310
Skipped tests: 90
Affected tests: 6

Click here to see the affected service packages
  • compute

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
  • TestAccComputeInstanceTemplate_provisioningModelEmptyString
  • TestAccComputeInstanceTemplate_reservationBound
  • TestAccComputeInstance_provisioningModelEmptyString
  • TestAccComputeInstance_reservationBound
  • TestAccComputeRegionInstanceTemplate_provisioningModelEmptyString
  • TestAccComputeRegionInstanceTemplate_reservationBound

Get to know how VCR tests work

@modular-magician
Copy link
Copy Markdown
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccComputeInstanceTemplate_provisioningModelEmptyString [Debug log]
TestAccComputeInstance_provisioningModelEmptyString [Debug log]
TestAccComputeRegionInstanceTemplate_provisioningModelEmptyString [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccComputeInstanceTemplate_reservationBound [Error message] [Debug log]
TestAccComputeInstance_reservationBound [Error message] [Debug log]
TestAccComputeRegionInstanceTemplate_reservationBound [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@github-actions
Copy link
Copy Markdown

@ScottSuarez This PR has been waiting for review for 3 weekdays. Please take a look! Use the label disable-review-reminders to disable these notifications.

@ScottSuarez ScottSuarez added this pull request to the merge queue Mar 24, 2026
Merged via the queue into GoogleCloudPlatform:main with commit 8e3f1ae Mar 24, 2026
23 of 24 checks passed
@shuyama1
Copy link
Copy Markdown
Member

🟢 Tests passed during RECORDING mode: TestAccComputeInstanceTemplate_provisioningModelEmptyString [Debug log] TestAccComputeInstance_provisioningModelEmptyString [Debug log] TestAccComputeRegionInstanceTemplate_provisioningModelEmptyString [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.

🔴 Tests failed during RECORDING mode: TestAccComputeInstanceTemplate_reservationBound [Error message] [Debug log] TestAccComputeInstance_reservationBound [Error message] [Debug log] TestAccComputeRegionInstanceTemplate_reservationBound [Error message] [Debug log]

🔴 Errors occurred during RECORDING mode. Please fix them to complete your PR.

View the build log or the debug log for each test

@ScottSuarez @MihajloLinic The failing tests are added in this PR and are now failing in VCR and nightly. Should we revert this PR or push an immediate fix?

@MihajloLinic
Copy link
Copy Markdown
Contributor Author

Its weird that tests for RESERVATION_BOUND are failing but not flex start ones because they are implemented exact same way plus im using the modified provider already in Coder setup and it was working

I can take a look in couple of hours the fix is probably small

@shuyama1
Copy link
Copy Markdown
Member

Its weird that tests for RESERVATION_BOUND are failing but not flex start ones because they are implemented exact same way plus im using the modified provider already in Coder setup and it was working

I can take a look in couple of hours the fix is probably small

Thanks @MihajloLinic! I’ll revert this for now. Please feel free to re-submit once the fix is ready. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants