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

appengine: Suppress null automatic_scaling blocks during Read #7262

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/10476.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
appengine: added suppression for a diff in google_app_engine_standard_app_version.automatic_scaling when the block is unset in configuration
```
Original file line number Diff line number Diff line change
Expand Up @@ -1254,6 +1254,35 @@ func flattenAppEngineStandardAppVersionAutomaticScaling(v interface{}, d *schema
flattenAppEngineStandardAppVersionAutomaticScalingMinPendingLatency(original["minPendingLatency"], d, config)
transformed["standard_scheduler_settings"] =
flattenAppEngineStandardAppVersionAutomaticScalingStandardSchedulerSettings(original["standardSchedulerSettings"], d, config)

// begin handwritten code (all other parts of this file are forked from generated code)
// solve for the following diff when no scaling settings are configured:
//
// - automatic_scaling {
// - max_concurrent_requests = 0 -> null
// - max_idle_instances = 0 -> null
// - min_idle_instances = 0 -> null
// }
//
// this happens because the field is returned as:
//
//"automaticScaling": {
// "standardSchedulerSettings": {}
// },
//
// this is hacky but avoids marking the field as computed, since it's in a oneof
// if any new fields are added to the block or explicit defaults start getting
// returned, it will need to be updated
if transformed["max_concurrent_requests"] == nil && // even primitives are nil at this stage if they're not returned by the API
transformed["max_idle_instances"] == nil &&
transformed["max_pending_latency"] == nil &&
transformed["min_idle_instances"] == nil &&
transformed["min_pending_latency"] == nil &&
transformed["standard_scheduler_settings"] == nil {
return nil
}
// end handwritten code

return []interface{}{transformed}
}
func flattenAppEngineStandardAppVersionAutomaticScalingMaxConcurrentRequests(v interface{}, d *schema.ResourceData, config *transport_tpg.Config) interface{} {
Expand Down