Skip to content

Commit

Permalink
revert bigtable change and fix flatten_object in update
Browse files Browse the repository at this point in the history
  • Loading branch information
danawillow committed Jan 3, 2020
1 parent d3e7297 commit 511f563
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ func expand<%= prefix -%><%= titlelize_property(property) -%>(v interface{}, d T
return nil, nil
}

return map[string]interface{}{}, nil
return bigtableadmin.MultiClusterRoutingUseAny{}, nil
}
16 changes: 10 additions & 6 deletions templates/terraform/resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -415,10 +415,12 @@ if <%= props.map { |prop| "d.HasChange(\"#{prop.name.underscore}\")" }.join ' ||
`NullFields` is a special case of `send_empty_value` where the empty value
in question is go's literal nil.
-%>
<% unless prop.send_empty_value -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop)) {
<% else -%>
<% if prop.send_empty_value -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop) {
<% elsif prop.flatten_object -%>
} else if !isEmptyValue(reflect.ValueOf(<%= prop.api_name -%>Prop)) {
<% else -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop)) {
<% end -%>
obj["<%= prop.api_name -%>"] = <%= prop.api_name -%>Prop
}
Expand Down Expand Up @@ -491,10 +493,12 @@ if <%= props.map { |prop| "d.HasChange(\"#{prop.name.underscore}\")" }.join ' ||
<%= prop.api_name -%>Prop, err := expand<%= resource_name -%><%= titlelize_property(prop) -%>(<%= schemaPrefix -%>, d, config)
if err != nil {
return err
<% unless prop.send_empty_value -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop)) {
<% else -%>
<% if prop.send_empty_value -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop) {
<% elsif prop.flatten_object -%>
} else if !isEmptyValue(reflect.ValueOf(<%= prop.api_name -%>Prop)) {
<% else -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop)) {
<% end -%>
obj["<%= prop.api_name -%>"] = <%= prop.api_name -%>Prop
}
Expand Down

0 comments on commit 511f563

Please sign in to comment.