Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff suppress storage transfer job start_time_of_day #1785

Merged

Conversation

emilymye
Copy link
Contributor

@emilymye emilymye commented May 17, 2019

When start_time_of_day is not specified, the API returns start_time_of_day: {}, which Terraform then sets as "start_time_of_day" = map[string]string{ "hours": 0, "minutes": 0, ...}.

We want a diff suppress here so that:

  • users can still supply empty value (no start_time_of_day or start_time_of_day = []) for modules or in general. Terraform will read the API default value in and the diff on second apply will be ignored.
  • if the user changes it to an empty value, Terraform will only show a diff (and forcenew) if the previous value was not zero'd out. e.g. TF will ignore start_time_of_day.#: 1 => 0 but won't ignore .hours: 10 -> 0, and thus will still recreate it with an "empty" start time

Related to hashicorp/terraform-provider-google#3626


[all]

[terraform]Diff suppress storage transfer job start_time_of_day

[terraform-beta]Diff suppress storage transfer job start_time_of_day

[ansible]

[inspec]

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
This PR seems not to have generated downstream PRs before, as of b9f8107.

Pull request statuses

No diff detected in terraform-google-conversion.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#723
depends: hashicorp/terraform-provider-google#3655

Copy link
Member

@rileykarson rileykarson left a comment

Choose a reason for hiding this comment

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

I'm a little hesitant to use a DSF for this purpose. I'm a little more supportive of not recording the field at all if the API returns an empty block (which we can tell by checking if any of the values are missing in the JSON, since they're all required), wdyt?

@emilymye
Copy link
Contributor Author

Discussed offline - because we're using Golang clients, we need to do DSF since we can't tell difference between existing key with empty value and existing key with all-zero'd values

@modular-magician modular-magician force-pushed the storagetransfercompute branch from b9f8107 to 9052914 Compare May 21, 2019 17:13
@modular-magician modular-magician merged commit 879e8fe into GoogleCloudPlatform:master May 21, 2019
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