Skip to content

Commit

Permalink
Fix error thrown when index configuration has no number_of_replicas s…
Browse files Browse the repository at this point in the history
…pecified

Signed-off-by: Rupa Lahiri <[email protected]>
  • Loading branch information
rblcoder committed Nov 7, 2023
1 parent b33b9cb commit 349b3d3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provider/resource_opensearch_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ var (
Type: schema.TypeString,
Description: "Number of shard replicas. A stringified number.",
Optional: true,
Computed: true,
},
"auto_expand_replicas": {
Type: schema.TypeString,
Expand Down Expand Up @@ -634,8 +635,10 @@ func resourceOpensearchIndexUpdate(d *schema.ResourceData, meta interface{}) err
settings := make(map[string]interface{})
for _, key := range settingsKeys {
schemaName := strings.Replace(key, ".", "_", -1)
if d.HasChange(schemaName) {
settings[key] = d.Get(schemaName)
if _, ok := d.GetOk(schemaName); ok {
if d.HasChange(schemaName) {
settings[key] = d.Get(schemaName)
}
}
}

Expand Down

0 comments on commit 349b3d3

Please sign in to comment.