-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: HELP: Error: The terraform-provider-mongodbatlas_v1.11.0 plugin crashed #1419
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,11 +9,10 @@ import ( | |
"strings" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" | ||
"github.com/mwielbut/pointy" | ||
"github.com/spf13/cast" | ||
|
||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
matlas "go.mongodb.org/atlas/mongodbatlas" | ||
) | ||
|
||
|
@@ -515,8 +514,11 @@ func expandAlertConfigurationMatchers(d *schema.ResourceData) []matlas.Matcher { | |
|
||
if m, ok := d.GetOk("matcher"); ok { | ||
for _, value := range m.([]interface{}) { | ||
v := value.(map[string]interface{}) | ||
if value == nil { | ||
break | ||
} | ||
|
||
v := value.(map[string]interface{}) | ||
matchers = append(matchers, matlas.Matcher{ | ||
FieldName: v["field_name"].(string), | ||
Operator: v["operator"].(string), | ||
|
@@ -610,6 +612,10 @@ func expandAlertConfigurationThresholdConfig(d *schema.ResourceData) *matlas.Thr | |
vL := value.([]interface{}) | ||
|
||
if len(vL) > 0 { | ||
if vL[0] == nil { | ||
return nil | ||
} | ||
|
||
v := vL[0].(map[string]interface{}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same as here. I have not fully tried myself, but was wondering if something like I also don't fully understand this one: in which cases would there be an array of length > 0 whose first value is nil? And why do we assume that all other values in the array will also be nil? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I tried to do it but the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, We can use the |
||
|
||
return &matlas.Threshold{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we do something similar to