Conversation
The `paused` field is Optional+Computed (default_from_api), so removing it
from configuration carried the prior state value (true) forward, producing
no diff. The post_update resume RPC only fires on d.HasChange("paused"), so
a previously-paused job stayed paused — contradicting the documented default
("Jobs default to being enabled when this property is not set").
Add a resumeJobWhenPausedUnset CustomizeDiff that forces the planned value to
false when the config attribute is null but state is true, generating the diff
that triggers the :resume RPC.
Add TestAccCloudSchedulerJob_pausedRemovedResumes covering the remove-attribute
path (the existing test only flipped paused to an explicit false).
|
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. |
paused is removed from config
|
Googlers: For automatic test runs see go/terraform-auto-test-runs. @c2thorn, 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. |
|
@c2thorn are you able to take a look at this PR. Thanks |
|
@c2thorn This PR has been waiting for review for 3 weekdays. Please take a look! Use the label |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes for commit 1c48aec: Diff reportYour PR generated the following diffs in downstream repositories:
Test reportAnalytics
Affected Service Packages
Step 1: Replaying Mode Action takenFound 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
View the replaying VCR build log Step 2: Recording Mode
🟢 All tests passed! View the recording VCR build log or the debug logs folder for detailed results. @philip-harvey, @roaks3, @c2thorn VCR tests complete for 1c48aec! |
roaks3
left a comment
There was a problem hiding this comment.
I was looking at the bug so just taking over the review here. Test basically confirms correct behavior (it's an additional test, but only takes ~15 sec to run), and implementation makes sense
6dade70
Fixes hashicorp/terraform-provider-google#29280
Summary
Fixes a bug where a Cloud Scheduler Job that was paused via
paused = truewould remain paused after the attribute was removed from configuration, even though the field docs state jobs default to enabled when unset.Root cause
pausedusesdefault_from_api: true, making the schema field Optional + Computed. When the attribute is removed from config, Terraform carries the prior state value (true) forward instead of treating it as unset. No diff is produced, sod.HasChange("paused")in thepost_updatehandler is false and the:resumeRPC never fires.Fix
New
resumeJobWhenPausedUnsetCustomizeDiff: when the raw config value forpausedis null but the current (state) value istrue, force the new value tofalse. This restores the documented default and produces the diff that drives the existing resume logic. Settingpaused = falseexplicitly is unchanged.Tests
TestAccCloudSchedulerJob_pausedRemovedResumes: setspaused = true(assertsPAUSED), then removes the attribute entirely (assertspaused = false/state = ENABLED). The pre-existingschedulerPausedExampletest only flippedpausedto an explicitfalse, so this regression was previously untested.Verification
Generated the beta provider and ran locally:
go build/go vetcloudscheduler service — cleanresumeJobWhenPausedUnsetis emitted and registered inCustomizeDiff.All(...)Acceptance test requires GCP credentials and is left to CI.
Release Note