Update documentation for google_bigquery_table.time_partitioning.expiration_ms#8827
Conversation
|
Hello! I am a robot. It looks like you are a: @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. |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: 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. If you intend to make this change you will need to wait for a major release window. An Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 1 insertion(+), 1 deletion(-)) |
|
Didn't realize this would be a breaking change. If it can potentially make it in to the 5.0.0 release I'll reparent this PR and prepare a corresponding doc change. |
Tests analyticsTotal tests: Action takenFound 5 affected test(s) by replaying old test recordings. Starting RECORDING based on the most recent commit. Click here to see the affected testsTestAccBigQueryTable_YearlyTimePartitioning|TestAccBigQueryTable_HourlyTimePartitioning|TestAccBigQueryTable_MonthlyTimePartitioning|TestAccBigQueryTable_Basic|TestAccBigQueryDataTable_bigtable |
|
Rerun these tests in REPLAYING mode to catch issues
|
Waiting for guidance |
| "expiration_ms": { | ||
| Type: schema.TypeInt, | ||
| Optional: true, | ||
| Computed: true, |
There was a problem hiding this comment.
computed is usually set when the contributor has found that the API returns the value for the field in some scenario where the user has not set it. Is it confirmed that the API never returns a value for this when not set?
There was a problem hiding this comment.
Reached out to the API team about it and waiting for official answer there, meanwhile exploring alternatives - if I need to keep Computed: true, should I then set a Default: nil alongside it to signal "use this default value if it's not in the config"?
Also thank you for your explanation of Computed. Much clearer than the official documentation...
There was a problem hiding this comment.
Computed: true and any Default conflict with each other. Essentially Optional + Computed means "default to the returned API value". Also adding a new Default value is a breaking change.
If Computed is needed, I think we can add custom logic to allow unsetting the value. I've seen RawConfig used before: https://github.com/GoogleCloudPlatform/magic-modules/blob/main/mmv1/third_party/terraform/services/sql/resource_sql_database_instance.go.erb#L2436
In the expander function for this field, I think you can check the user value to see if it is nil, then return that instead. I'm not 100% confident, and it will need some testing however. RawConfig is somewhat new. Doing that would not be a breaking change.
There was a problem hiding this comment.
Thank you. Meanwhile I learned why this attribute was marked Computed: true - BigQuery tables belong in BigQuery datasets, a separate resource, and a dataset may come with a default expiration time, which should be propagated to all the new tables created in it. In the case that a dataset default expiration is set, the absence of table-level expiration should be treated as "using the dataset-level default" instead of "no expiration".
Unless there is a way in the provider to achieve conditionally treating this value differently based on a dataset field value (is there?), given the nature of this design, I'm inclined to treat the current behavior as working-as-intended and just update documentation to suggest users to specify expiration_ms = 0 if they need to explicitly unset. Let me know what you think.
There was a problem hiding this comment.
Unless there is a way in the provider to achieve conditionally treating this value differently based on a dataset field value (is there?)
We have scenarios where we call the read API for one resource from within another. As far as reading the "Terraform set" value from another resource, I don't think we've ever done that (although it may be possible?)
Either way, it seems that the field should reasonably stay Computed.
I'm inclined to treat the current behavior as working-as-intended and just update documentation to suggest users to specify expiration_ms = 0 if they need to explicitly unset. Let me know what you think.
That seems reasonable to me. I should have checked if expiration_ms = 0 worked earlier, that is in line with other similar fields that are Computed.
There was a problem hiding this comment.
We have scenarios where we call the read API for one resource from within another.
Thank you, this should be enough in this case, but I'll first reply in the GitHub issue explaining the situation with Computed and pursuing the WAI path first, unless there is strong push back there. Will comment here again once the PR is updated accordingly.
There was a problem hiding this comment.
We have scenarios where we call the read API for one resource from within another.
Thank you, this should be enough in this case, but I'll first reply in the GitHub issue explaining the situation with
Computedand pursuing the WAI path first, unless there is strong push back there. Will comment here again once the PR is updated accordingly.
User confirmed in hashicorp/terraform-provider-google#15626 that leaving the field Computed: true and setting the value to 0 achieved the desired effect. I updated the PR to be only a documentation change (and a trivial test change).
And thank you for all the insights in this thread!
Asked a question in another comment. If moving forward, then yes this can go into 5.0.0 |
|
Hi there, I'm the Modular magician. I've detected the following information about your changes: 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. If you intend to make this change you will need to wait for a major release window. An Diff reportYour PR generated some diffs in downstreams - here they are. Terraform GA: Diff ( 2 files changed, 6 insertions(+), 3 deletions(-)) |
|
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. Terraform GA: Diff ( 2 files changed, 6 insertions(+), 2 deletions(-)) |
Tests analyticsTotal tests: 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 testsTestAccDataSourceGoogleServiceAccountIdToken_impersonation |
|
Rerun these tests in REPLAYING mode to catch issues
|
Fixes hashicorp/terraform-provider-google#15626.
If this PR is for Terraform, I acknowledge that I have:
make testandmake lintin the generated providers to ensure it passes unit and linter tests.Release Note Template for Downstream PRs (will be copied)