Skip to content

Commit

Permalink
rename MetaEncode to DiffEncode
Browse files Browse the repository at this point in the history
  • Loading branch information
catsby committed Feb 23, 2017
1 parent aa48178 commit 8d14c4e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions helper/schema/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ func (r *Resource) Diff(
}

if instanceDiff != nil {
if err := t.MetaEncode(instanceDiff); err != nil {
// not sure MetaEncode will actually return an error
if err := t.DiffEncode(instanceDiff); err != nil {
// not sure DiffEncode will actually return an error
log.Printf("[ERR] Error encoding timeout to instance diff: %s", err)
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions helper/schema/resource_timeout.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,12 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig)
return nil
}

// MetaEncode and MetaDecode are analogous to the Go stdlib JSONEncoder
// DiffEncode and MetaDecode are analogous to the Go stdlib JSONEncoder
// interface: they encode/decode a timeouts struct from an instance diff, which is
// where the timeout data is stored after a diff to pass into Apply.
//
// TODO: when should this error?
func (t *ResourceTimeout) MetaEncode(id *terraform.InstanceDiff) error {
func (t *ResourceTimeout) DiffEncode(id *terraform.InstanceDiff) error {
m := make(map[string]interface{})

if t.Create != nil {
Expand Down
4 changes: 2 additions & 2 deletions helper/schema/resource_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func TestResourceTimeout_ConfigDecode(t *testing.T) {
}
}

func TestResourceTimeout_MetaEncode_basic(t *testing.T) {
func TestResourceTimeout_DiffEncode_basic(t *testing.T) {
cases := []struct {
Timeout *ResourceTimeout
Expected map[string]interface{}
Expand Down Expand Up @@ -121,7 +121,7 @@ func TestResourceTimeout_MetaEncode_basic(t *testing.T) {

for _, c := range cases {
state := &terraform.InstanceDiff{}
err := c.Timeout.MetaEncode(state)
err := c.Timeout.DiffEncode(state)
if err != nil && !c.ShouldErr {
t.Fatalf("Error, expected:\n%#v\n got:\n%#v\n", c.Expected, state.Meta)
}
Expand Down

0 comments on commit 8d14c4e

Please sign in to comment.