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

[synthetics_test] Handle request_file when state does not exist #2659

Merged
merged 1 commit into from
Nov 11, 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
9 changes: 6 additions & 3 deletions datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -2877,9 +2877,12 @@ func buildDatadogBodyFiles(attr []interface{}) []datadogV1.SyntheticsTestRequest
func buildTerraformBodyFiles(actualBodyFiles *[]datadogV1.SyntheticsTestRequestBodyFile, oldLocalBodyFiles []map[string]interface{}) (localBodyFiles []map[string]interface{}) {
localBodyFiles = make([]map[string]interface{}, len(*actualBodyFiles))
for i, file := range *actualBodyFiles {
// The file content is kept from the existing localFile from the state,
// as the response from the backend contains the bucket key rather than the content.
localFile := oldLocalBodyFiles[i]
localFile := make(map[string]interface{})
if i < len(oldLocalBodyFiles) && oldLocalBodyFiles[i] != nil {
// The file content is kept from the existing localFile from the state,
// as the response from the backend contains the bucket key rather than the content.
localFile = oldLocalBodyFiles[i]
}
localFile["name"] = file.GetName()
localFile["original_file_name"] = file.GetOriginalFileName()
localFile["type"] = file.GetType()
Expand Down
Loading