Skip to content

feat: Add support for preemption_notice_duration in compute instance scheduling#16514

Merged
melinath merged 3 commits into
GoogleCloudPlatform:mainfrom
NemilShah007:add-preemption-notice-duration
Mar 3, 2026
Merged

feat: Add support for preemption_notice_duration in compute instance scheduling#16514
melinath merged 3 commits into
GoogleCloudPlatform:mainfrom
NemilShah007:add-preemption-notice-duration

Conversation

@NemilShah007

@NemilShah007 NemilShah007 commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Preemption notice duration feature support in terraform

See Scheduling PreemptionNoticeDuration section in https://pkg.go.dev/google.golang.org/api/compute/v0.beta.

Release Note Template for Downstream PRs (will be copied)

See Write release notes for guidance.

compute: added `preemption_notice_duration` field to `google_compute_instance`, `google_compute_instance_template`, and `google_compute_instance_from_machine_image ` resources (beta)

@github-actions github-actions Bot requested a review from melinath February 24, 2026 19:44
@github-actions

Copy link
Copy Markdown

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

@melinath, 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

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@NemilShah007 NemilShah007 force-pushed the add-preemption-notice-duration branch from 1787db2 to 283e8bc Compare February 24, 2026 21:04
@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@modular-magician

This comment was marked as outdated.

@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 ( 5 files changed, 77 insertions(+), 13 deletions(-))
google-beta provider: Diff ( 19 files changed, 619 insertions(+), 13 deletions(-))
terraform-google-conversion: Diff ( 1 file changed, 43 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_instance (411 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance" "primary" {
  scheduling {
    maintenance_interval = # value needed
  }
}

Resource: google_compute_instance_from_machine_image (18 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_machine_image" "primary" {
  scheduling {
    availability_domain  = # value needed
    maintenance_interval = # value needed
    min_node_cpus        = # value needed
    preemption_notice_duration {
      nanos = # value needed
    }
  }
}

Resource: google_compute_instance_from_template (28 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_template" "primary" {
  scheduling {
    availability_domain  = # value needed
    maintenance_interval = # value needed
    min_node_cpus        = # value needed
    on_host_maintenance  = # value needed
  }
}

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_compute_instance_from_machine_image
    • Expected Document Path: /website/docs/r/compute_instance_from_machine_image.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]
  • google_compute_instance_from_template
    • Expected Document Path: /website/docs/r/compute_instance_from_template.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]
  • google_compute_region_instance_template
    • Expected Document Path: /website/docs/r/compute_region_instance_template.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 6086
Passed tests: 5445
Skipped tests: 636
Affected tests: 5

Click here to see the affected service packages

All service packages are affected

Action taken

Found 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
  • TestAccCloudbuildWorkerPool_withNetwork
  • TestAccComputeInstanceFromTemplate_schedulingPreemptionNoticeDuration
  • TestAccDataSourceArtifactRegistryRepositories_basic
  • TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate
  • TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController

Get to know how VCR tests work

@modular-magician

Copy link
Copy Markdown
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccCloudbuildWorkerPool_withNetwork [Debug log]
TestAccComputeInstanceFromTemplate_schedulingPreemptionNoticeDuration [Debug log]
TestAccDataSourceArtifactRegistryRepositories_basic [Debug log]

🟢 No issues found for passed tests after REPLAYING rerun.


🔴 Tests failed during RECORDING mode:
TestAccGKEHubFeatureMembership_gkehubFeatureAcmUpdate [Error message] [Debug log]
TestAccGKEHubFeatureMembership_gkehubFeaturePolicyController [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

@melinath melinath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Overall this looks good. The failing tests are unrelated to your code changes (but could be related to the dependency changes). The missing tests look mostly unrelated (with one exception noted below.) The missing docs notices seem like misfires due to the way these docs pages work; I see the fields added.

Please create a separate PR containing just the dependency upgrades, as described in https://googlecloudplatform.github.io/magic-modules/develop/update-dependencies/ Once that's merged & this PR is rebased, I think we should be good to go.

@NemilShah007 NemilShah007 force-pushed the add-preemption-notice-duration branch from c98a9d8 to 5444c30 Compare February 27, 2026 00:07
@github-actions github-actions Bot requested a review from melinath February 27, 2026 00:08
@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 ( 3 files changed, 39 insertions(+))
google-beta provider: Diff ( 17 files changed, 582 insertions(+))
terraform-google-conversion: Diff ( 1 file changed, 43 insertions(+))

Missing test report

Your PR includes resource fields which are not covered by any test.

Resource: google_compute_instance (411 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance" "primary" {
  scheduling {
    maintenance_interval = # value needed
  }
}

Resource: google_compute_instance_from_machine_image (18 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_machine_image" "primary" {
  scheduling {
    availability_domain  = # value needed
    maintenance_interval = # value needed
    min_node_cpus        = # value needed
  }
}

Resource: google_compute_instance_from_template (28 total tests)
Please add an acceptance test which includes these fields. The test should include the following:

resource "google_compute_instance_from_template" "primary" {
  scheduling {
    availability_domain  = # value needed
    maintenance_interval = # value needed
    min_node_cpus        = # value needed
    on_host_maintenance  = # value needed
  }
}

Missing doc report (experimental)

The following resources have fields missing in documents.

  • google_compute_instance_from_machine_image
    • Expected Document Path: /website/docs/r/compute_instance_from_machine_image.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]
  • google_compute_instance_from_template
    • Expected Document Path: /website/docs/r/compute_instance_from_template.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]
  • google_compute_region_instance_template
    • Expected Document Path: /website/docs/r/compute_region_instance_template.html.markdown
    • Fields: [scheduling.preemption_notice_duration scheduling.preemption_notice_duration.nanos scheduling.preemption_notice_duration.seconds]

@modular-magician

Copy link
Copy Markdown
Collaborator

Tests analytics

Total tests: 1372
Passed tests: 1282
Skipped tests: 90
Affected tests: 0

Click here to see the affected service packages
  • compute

🟢 All tests passed!

View the build log

@melinath melinath left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I see the go.mod changes aren't here any more but I don't see a recent upgrade to the compute package or dependency upgrade from you... but also, the tests here aren't failing. So this is probably all good, but I just want to double-check that everything's fine? Why isn't the go.mod change required any more?

@NemilShah007

Copy link
Copy Markdown
Contributor Author

I see the go.mod changes aren't here any more but I don't see a recent upgrade to the compute package or dependency upgrade from you... but also, the tests here aren't failing. So this is probably all good, but I just want to double-check that everything's fine? Why isn't the go.mod change required any more?

I performed a git pull to sync with the latest main branch and re-ran the test suite. Everything is passing consistently now. It’s possible a recent parallel update to our dependencies addressed the versioning requirement, or the specific upgrade is no longer a blocker for these tests.

@NemilShah007 NemilShah007 requested a review from melinath March 2, 2026 23:38
@NemilShah007 NemilShah007 deleted the add-preemption-notice-duration branch March 3, 2026 22:08
aditikumarii-google pushed a commit to aditikumarii-google/magic-modules that referenced this pull request Mar 10, 2026
ChuAmberZhang pushed a commit to ChuAmberZhang/magic-modules that referenced this pull request Apr 29, 2026
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.

3 participants