Skip to content
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

[datadog_synthetics_test] Handle secure config_variables on import #2653

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading