Skip to content

fix: (storagetransfer) transfer path can be changed to empty string#14300

Closed
gurusai-voleti wants to merge 12 commits intoGoogleCloudPlatform:FEATURE-BRANCH-major-release-7.0.0from
gurusai-voleti:sts_path
Closed

fix: (storagetransfer) transfer path can be changed to empty string#14300
gurusai-voleti wants to merge 12 commits intoGoogleCloudPlatform:FEATURE-BRANCH-major-release-7.0.0from
gurusai-voleti:sts_path

Conversation

@gurusai-voleti
Copy link
Contributor

Release Note Template for Downstream PRs (will be copied)
Fixes: hashicorp/terraform-provider-google#13673
See Write release notes for guidance.

storagetransfer: fix to allow empty string for path

@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.

google provider: Diff ( 3 files changed, 206 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 206 insertions(+), 7 deletions(-))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 15
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • storagetransfer

Action taken

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
  • TestAccStorageTransferJob_transferPathError

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccStorageTransferJob_transferPathError [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

@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.

google provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

@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.

google provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 16
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • storagetransfer

🟢 All tests passed!

View the build log

@gurusai-voleti gurusai-voleti marked this pull request as ready for review June 23, 2025 06:45
@github-actions github-actions bot requested a review from ScottSuarez June 23, 2025 06:46
@github-actions
Copy link

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.

@kautikdk
Copy link
Member

Hi @gurusai-voleti, what is the solution that you are proposing here?

@ScottSuarez
Copy link
Contributor

This appears to be a breaking change, see #14300 (comment)

@gurusai-voleti
Copy link
Contributor Author

Hi @gurusai-voleti, what is the solution that you are proposing here?

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
which they cannot as in update d.HasChanges will not detect empty string as a change and an empty string cannot be considered for computed field as per terraform sdk (error occurred with computed set to true A computed value with the empty string as the new value and a non-empty old value was found. Interpreting the empty string as "unset" to align with legacy behavior.) so tf plan/apply will show no changes required, so removed computed for the field and as it is user provided no need of computed as well

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

@gurusai-voleti
Copy link
Contributor Author

This appears to be a breaking change, see #14300 (comment)

yes it's a breaking change, so created an PR on top 7.0 feature branch, Anything else needs to be taken care?

@kautikdk
Copy link
Member

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),
Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 {
Copy link
Member

Choose a reason for hiding this comment

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

Where is this being used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 {
Copy link
Member

Choose a reason for hiding this comment

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

If we are removing Computed behavior then do we need this DiffSupressFunc?

Copy link
Contributor

Choose a reason for hiding this comment

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

May still be relevant if API alters user input

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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 /
Copy link
Member

Choose a reason for hiding this comment

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

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.

Reference: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/website/docs/guides/version_6_upgrade.html.markdown#advanced_datapath_observability_configrelay_mode-is-now-removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated description

@gurusai-voleti
Copy link
Contributor Author

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?

even if its computed or not, as its optional field if API response has value, it can be set otherwise not

@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.

google provider: Diff ( 3 files changed, 123 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 123 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Errors

google-beta provider:

  • Failed to detect subcategory in the frontmatter in file website/docs/guides/version_7_upgrade.html.markdown.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 15
Skipped tests: 0
Affected tests: 1

Click here to see the affected service packages
  • storagetransfer
#### Action taken
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
  • TestAccStorageTransferJob_transferUpdateToEmptyString

Get to know how VCR tests work

@modular-magician
Copy link
Collaborator

🟢 Tests passed during RECORDING mode:
TestAccStorageTransferJob_transferUpdateToEmptyString [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

@ScottSuarez
Copy link
Contributor

This appears to be a breaking change, see #14300 (comment)

yes it's a breaking change, so created an PR on top 7.0 feature branch, Anything else needs to be taken care?

oops, I didn't realize we opened for changes to the major release branch. Thanks for that !!

@ScottSuarez
Copy link
Contributor

Looks like merging main into this branch has added unintended changes here.

@gurusai-voleti
Copy link
Contributor Author

Looks like merging main into this branch has added unintended changes here.

git rebase went wrong

This reverts commit 04e72e6.
@ScottSuarez
Copy link
Contributor

ScottSuarez commented Jun 25, 2025

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?

even if its computed or not, as its optional field if API response has value, it can be set otherwise not

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.

@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.

google provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Errors

google-beta provider:

  • Failed to detect subcategory in the frontmatter in file website/docs/guides/version_7_upgrade.html.markdown.

This reverts commit 00164d2.
@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 16
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • storagetransfer
🟢 All tests passed!

View the build log

@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.

google provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 205 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Errors

google-beta provider:

  • Failed to detect subcategory in the frontmatter in file website/docs/guides/version_7_upgrade.html.markdown.

@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.

google provider: Diff ( 3 files changed, 123 insertions(+), 7 deletions(-))
google-beta provider: Diff ( 3 files changed, 123 insertions(+), 7 deletions(-))

Breaking Change(s) Detected

The following breaking change(s) were detected within your pull request.

  • Field replication_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field replication_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_sink.path transitioned from optional+computed to optional google_storage_transfer_job - reference
  • Field transfer_spec.gcs_data_source.path transitioned from optional+computed to optional google_storage_transfer_job - reference

If you believe this detection to be incorrect please raise the concern with your reviewer.
If you intend to make this change you will need to wait for a major release window.
An override-breaking-change label can be added to allow merging.

Errors

google-beta provider:

  • Failed to detect subcategory in the frontmatter in file website/docs/guides/version_7_upgrade.html.markdown.

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 16
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • storagetransfer
🟢 All tests passed!

View the build log

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 16
Passed tests: 16
Skipped tests: 0
Affected tests: 0

Click here to see the affected service packages
  • storagetransfer
🟢 All tests passed!

View the build log

@gurusai-voleti
Copy link
Contributor Author

gurusai-voleti commented Jun 26, 2025

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

@gurusai-voleti
Copy link
Contributor Author

why it was marke

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?

even if its computed or not, as its optional field if API response has value, it can be set otherwise not

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.

if the user doesn't provide any value, API doesn't set any value, it just reflects what user provided

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