Skip to content

Commit

Permalink
Remove unused update_statement code (#1407)
Browse files Browse the repository at this point in the history
Merged PR #1407.
  • Loading branch information
rileykarson authored and modular-magician committed Feb 19, 2019
1 parent eb619ec commit e3e2932
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 deletions.
28 changes: 9 additions & 19 deletions overrides/terraform/property_override.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,31 +70,22 @@ def self.attributes
# All custom code attributes are string-typed. The string should
# be the name of a template file which will be compiled in the
# specified / described place.
#
# Property Updates are used when a resource is updateable but
# resource.input is true. In this case, only individual
# properties can be updated. The value of this attribute should
# be the path to a template which will be compiled. This code is placed
# *inline* in the obj := { ... } definition - it is not a custom
# function, it is a custom statement. Note that this cannot
# be used for nested properties, as they are not present in the
# obj := {...} statement. This statement template receives `property`
# and `prefix` to aid in code reuse.
:update_statement,

# A custom expander replaces the default expander for an attribute.
# It is called as part of Create, and as part of Update if
# object.input is false. It can return an object of any type,
# so the function header *is* part of the custom code template.
# As with flatten, `property` and `prefix` are available.
:custom_expand,

# A custom flattener replaces the default flattener for an attribute.
# It is called as part of Read. It can return an object of any
# type, and may sometimes need to return an object with non-interface{}
# type so that the d.Set() call will succeed, so the function
# header *is* a part of the custom code template. To help with
# creating the function header, `property` and `prefix` are available,
# just as they are in the standard flattener template.
:custom_flatten,
# A custom expander replaces the default expander for an attribute.
# It is called as part of Create, and as part of Update if
# object.input is false. It can return an object of any type,
# so the function header *is* part of the custom code template.
# As with flatten, `property` and `prefix` are available.
:custom_expand
:custom_flatten
]
end

Expand All @@ -117,7 +108,6 @@ def validate
check :validation, type: Provider::Terraform::Validation
check :set_hash_func, type: String

check :update_statement, type: String
check :custom_flatten, type: String
check :custom_expand, type: String

Expand Down
6 changes: 0 additions & 6 deletions templates/terraform/resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,7 @@ func resource<%= resource_name -%>Update(d *schema.ResourceData, meta interface{
<% else -%>
} else if v, ok := d.GetOkExists("<%= prop.name.underscore -%>"); ok || !reflect.DeepEqual(v, <%= prop.api_name -%>Prop) {
<% end -%>
<% if prop.update_statement -%>
obj["<%= prop.api_name -%>"] = <%= compile_template(prop.update_statement,
prefix: resource_name,
property: prop) -%>
<% else -%>
obj["<%= prop.api_name -%>"] = <%= prop.api_name -%>Prop
<% end -%>
}
<% else # if update_body_properties.include? prop -%>
<%= prop.api_name -%>Prop := d.Get("<%= prop.name.underscore -%>")
Expand Down

0 comments on commit e3e2932

Please sign in to comment.