fix: (storagetransfer) transfer path can be changed to empty string#14300
fix: (storagetransfer) transfer path can be changed to empty string#14300gurusai-voleti wants to merge 12 commits intoGoogleCloudPlatform:FEATURE-BRANCH-major-release-7.0.0from
Conversation
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
|
Tests analyticsTotal tests: 16 Click here to see the affected service packages
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
|
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. |
Tests analyticsTotal tests: 16 Click here to see the affected service packages
🟢 All tests passed! View the build log |
|
Hello! I am a robot. Tests will require approval from a repository maintainer to run. 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. |
|
Hi @gurusai-voleti, what is the solution that you are proposing here? |
|
This appears to be a breaking change, see #14300 (comment) |
firstly the field is missing validation, added validation to the path field as gcs object path cannot be started with "/" (reference here https://cloud.google.com/storage-transfer/docs/reference/rest/v1/GcsData) and field is an user provided and cannot be marked as computed so changed path to optional field only as the customer reported issue they used "/" first and later realized to change to "" empty string as d.HasChanges and computed cannot consider empty string as a change or input, added DiffSuppressFunc if the old and new is same it will not show any difference in tf plan, if its different it will show difference in tf plan and path can be updated to "" empty string |
yes it's a breaking change, so created an PR on top 7.0 feature branch, Anything else needs to be taken care? |
|
If the field is currently Computed, do we know why it was marked as such? i.e Was there any change from the API side which mandated this field to get server side value as well if not provided by user? |
| Steps: []resource.TestStep{ | ||
| { | ||
| Config: testAccStorageTransferJob_transferJobPathError(envvar.GetTestProjectFromEnv(), testDataSourceBucketName, testDataSinkName, testTransferJobDescription, testTransferJobName), | ||
| ExpectError: regexp.MustCompile(errorMessage), |
There was a problem hiding this comment.
I don't think we need error validation in the acceptance tests. We should add unit test instead to validate the change which is not related to the API integratiion.
Reference: https://googlecloudplatform.github.io/magic-modules/test/test/#add-resource-tests
There was a problem hiding this comment.
removed the validation test case
| `, project, dataSourceBucketName, project, dataSinkBucketName, project, testTransferJobName, transferJobDescription, project) | ||
| } | ||
|
|
||
| func testAccStorageTransferJob_transferJobGcsPath(project string, dataSourceBucketName string, dataSinkBucketName string, transferJobDescription string, testTransferJobName string, gcsPath string) string { |
There was a problem hiding this comment.
updated test case
| Type: schema.TypeString, | ||
| Description: `Google Cloud Storage path in bucket to transfer`, | ||
| ValidateFunc: validatePath, | ||
| DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool { |
There was a problem hiding this comment.
If we are removing Computed behavior then do we need this DiffSupressFunc?
There was a problem hiding this comment.
May still be relevant if API alters user input
There was a problem hiding this comment.
no API doesn't alter user input, removed the diffsuppressfunc
| ## Resource: `google_storage_transfer_job` | ||
|
|
||
| ### Resource-level change example header | ||
| ### `path` does not allow strings starting with / |
There was a problem hiding this comment.
We should add full field name here including parent block names otherwise it will mislead users. Only specifying path will be interpreted as top level field within the google_storage_transfer_job resource.
There was a problem hiding this comment.
updated description
even if its computed or not, as its optional field if API response has value, it can be set otherwise not |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. Errors
|
Tests analyticsTotal tests: 16 Click here to see the affected service packages
Found 1 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected tests
|
oops, I didn't realize we opened for changes to the major release branch. Thanks for that !! |
|
Looks like merging main into this branch has added unintended changes here. |
git rebase went wrong |
This reverts commit 04e72e6.
Do we have understanding of when/in what scenario server sets a value for this field independent of user input? While yes we can switch to optional here, I am looking to see how disruptive this might be for the user. If the user needs to deploy then define this field post deployment because the server returned some value this is not an optimal experience. In such a case we should likely explicitly set the value to empty string if valid to avoid two step apply. As long as such a change isn't very divergent from normal user flow. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. Errors
|
This reverts commit 00164d2.
Tests analyticsTotal tests: 16 Click here to see the affected service packages
View the build log |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. Errors
|
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: Diff reportYour PR generated some diffs in downstreams - here they are.
Breaking Change(s) DetectedThe following breaking change(s) were detected within your pull request.
If you believe this detection to be incorrect please raise the concern with your reviewer. Errors
|
Tests analyticsTotal tests: 16 Click here to see the affected service packages
View the build log |
Tests analyticsTotal tests: 16 Click here to see the affected service packages
View the build log |
|
this branch has been corrupted created a new PR here #14377, please check the new PR @kautikdk @ScottSuarez please add yourself as a reviewer for new PR |
if the user doesn't provide any value, API doesn't set any value, it just reflects what user provided |
Release Note Template for Downstream PRs (will be copied)
Fixes: hashicorp/terraform-provider-google#13673
See Write release notes for guidance.