diff --git a/provider/resource_opensearch_channel_configuration.go b/provider/resource_opensearch_channel_configuration.go index 9dc0912..23238a5 100644 --- a/provider/resource_opensearch_channel_configuration.go +++ b/provider/resource_opensearch_channel_configuration.go @@ -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) + + if _, ok := openDistroChannelConfigurationSchema["body"]; ok { + json, err := json.Marshal(res.ChannelConfigurationInfos[0]) + if err != nil { + return err + } + d.Set("body", json) } - err = d.Set("body", channelConfigurationJsonNormalized) - return err + + return nil + } func resourceOpensearchOpenDistroChannelConfigurationUpdate(d *schema.ResourceData, m interface{}) error {