Skip to content

Commit

Permalink
fix import (#2653)
Browse files Browse the repository at this point in the history
  • Loading branch information
skarimo authored Nov 8, 2024
1 parent ba07aab commit b27579d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -2936,8 +2936,11 @@ func buildTerraformConfigVariables(configVariables []datadogV1.SyntheticsConfigV
// If the variable is secure, the example and pattern are not returned by the API,
// so we need to keep the values from the terraform config.
if v, ok := localVariable["secure"].(bool); ok && v {
localVariable["example"] = oldConfigVariables[i].(map[string]interface{})["example"].(string)
localVariable["pattern"] = oldConfigVariables[i].(map[string]interface{})["pattern"].(string)
// There is no previous state to fallback on during import
if i < len(oldConfigVariables) && oldConfigVariables[i] != nil {
localVariable["example"] = oldConfigVariables[i].(map[string]interface{})["example"].(string)
localVariable["pattern"] = oldConfigVariables[i].(map[string]interface{})["pattern"].(string)
}
} else {
if v, ok := configVariable.GetExampleOk(); ok {
localVariable["example"] = *v
Expand Down

0 comments on commit b27579d

Please sign in to comment.