Skip to content

Commit

Permalink
Fix persistent delete of config_id (88)
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Miller <[email protected]>
  • Loading branch information
Aaron Miller committed Oct 15, 2023
1 parent 24a1c29 commit 58b3472
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions provider/resource_opensearch_channel_configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,23 +64,25 @@ func resourceOpensearchOpenDistroChannelConfigurationRead(d *schema.ResourceData
d.SetId("")
return nil
}

if err != nil {
return err
}
configId := res.ChannelConfigurationInfos[0]["config_id"].(string)

d.SetId(res.ChannelConfigurationInfos[0]["config_id"].(string))
log.Printf("[DEBUG] Config ID from API: %v", configId)

channelConfigurationJson, err := json.Marshal(res.ChannelConfigurationInfos[0])
if err != nil {
return err
}
channelConfigurationJsonNormalized, err := structure.NormalizeJsonString(string(channelConfigurationJson))
if err != nil {
return err
d.Set("config_id", configId)

Check failure on line 74 in provider/resource_opensearch_channel_configuration.go

View workflow job for this annotation

GitHub Actions / Runs go linters

Error return value of `d.Set` is not checked (errcheck)

if _, ok := openDistroChannelConfigurationSchema["body"]; ok {
json, err := json.Marshal(res.ChannelConfigurationInfos[0])
if err != nil {
return err
}
d.Set("body", json)

Check failure on line 81 in provider/resource_opensearch_channel_configuration.go

View workflow job for this annotation

GitHub Actions / Runs go linters

Error return value of `d.Set` is not checked (errcheck)
}
err = d.Set("body", channelConfigurationJsonNormalized)
return err

return nil

}

func resourceOpensearchOpenDistroChannelConfigurationUpdate(d *schema.ResourceData, m interface{}) error {
Expand Down

0 comments on commit 58b3472

Please sign in to comment.