@@ -44,7 +44,7 @@ func resource_dnsimple_record_create(
4444 rs .ID = recId
4545 log .Printf ("[INFO] record ID: %s" , rs .ID )
4646
47- record , err := resource_dnsimple_record_retrieve (s .Attributes ["domain" ], s .ID , client )
47+ record , err := resource_dnsimple_record_retrieve (rs .Attributes ["domain" ], rs .ID , client )
4848 if err != nil {
4949 return nil , fmt .Errorf ("Couldn't find record: %s" , err )
5050 }
@@ -62,11 +62,6 @@ func resource_dnsimple_record_update(
6262
6363 updateRecord := dnsimple.ChangeRecord {}
6464
65- record , err := resource_dnsimple_record_retrieve (s .Attributes ["domain" ], s .ID , client )
66- if err != nil {
67- return nil , fmt .Errorf ("Couldn't find record: %s" , err )
68- }
69-
7065 if attr , ok := d .Attributes ["name" ]; ok {
7166 updateRecord .Name = attr .New
7267 }
@@ -85,14 +80,14 @@ func resource_dnsimple_record_update(
8580
8681 log .Printf ("[DEBUG] record update configuration: %#v" , updateRecord )
8782
88- _ , err = client .UpdateRecord (rs .Attributes ["domain" ], rs .ID , & updateRecord )
83+ _ , err : = client .UpdateRecord (rs .Attributes ["domain" ], rs .ID , & updateRecord )
8984 if err != nil {
90- return nil , fmt .Errorf ("Failed to update record: %s" , err )
85+ return rs , fmt .Errorf ("Failed to update record: %s" , err )
9186 }
9287
93- record , err = resource_dnsimple_record_retrieve (s .Attributes ["domain" ], s .ID , client )
88+ record , err : = resource_dnsimple_record_retrieve (rs .Attributes ["domain" ], rs .ID , client )
9489 if err != nil {
95- return nil , fmt .Errorf ("Couldn't find record: %s" , err )
90+ return rs , fmt .Errorf ("Couldn't find record: %s" , err )
9691 }
9792
9893 return resource_dnsimple_record_update_state (rs , record )
@@ -104,9 +99,9 @@ func resource_dnsimple_record_destroy(
10499 p := meta .(* ResourceProvider )
105100 client := p .client
106101
107- log .Printf ("[INFO] Deleting record: %s" , s .ID )
102+ log .Printf ("[INFO] Deleting record: %s, %s" , s . Attributes [ "domain" ] , s .ID )
108103
109- err := client .DestroyRecord (s .ID )
104+ err := client .DestroyRecord (s .Attributes [ "domain" ], s . ID )
110105
111106 if err != nil {
112107 return fmt .Errorf ("Error deleting record: %s" , err )
@@ -121,7 +116,7 @@ func resource_dnsimple_record_refresh(
121116 p := meta .(* ResourceProvider )
122117 client := p .client
123118
124- rec , err := resource_dnsimple_record_retrieve (s .Attributes ["app " ], s .ID , client )
119+ rec , err := resource_dnsimple_record_retrieve (s .Attributes ["domain " ], s .ID , client )
125120 if err != nil {
126121 return nil , err
127122 }
@@ -146,6 +141,7 @@ func resource_dnsimple_record_diff(
146141 ComputedAttrs : []string {
147142 "priority" ,
148143 "domain_id" ,
144+ "ttl" ,
149145 },
150146 }
151147
@@ -169,10 +165,10 @@ func resource_dnsimple_record_update_state(
169165func resource_dnsimple_record_retrieve (domain string , id string , client * dnsimple.Client ) (* dnsimple.Record , error ) {
170166 record , err := client .RetrieveRecord (domain , id )
171167 if err != nil {
172- return nil , fmt . Errorf ( "Error retrieving record: %s" , err )
168+ return nil , err
173169 }
174170
175- return & record , nil
171+ return record , nil
176172}
177173
178174func resource_dnsimple_record_validation () * config.Validator {
0 commit comments