Skip to content

Commit

Permalink
[datadog_synthetics_test] Do not send field if empty (#2533)
Browse files Browse the repository at this point in the history
  • Loading branch information
Drarig29 authored Aug 16, 2024
1 parent 01cad06 commit 1a07424
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 48 deletions.
5 changes: 4 additions & 1 deletion datadog/resource_datadog_synthetics_test_.go
Original file line number Diff line number Diff line change
Expand Up @@ -2934,9 +2934,12 @@ func buildDatadogExtractedValues(stepExtractedValues []interface{}) []datadogV1.
value := datadogV1.SyntheticsParsingOptions{}

value.SetName(extractedValueMap["name"].(string))
value.SetField(extractedValueMap["field"].(string))
value.SetType(datadogV1.SyntheticsGlobalVariableParseTestOptionsType(extractedValueMap["type"].(string)))

if extractedValueMap["field"] != "" {
value.SetField(extractedValueMap["field"].(string))
}

valueParsers := extractedValueMap["parser"].([]interface{})
valueParser := valueParsers[0].(map[string]interface{})

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024-08-01T22:13:00.200996+02:00
2024-08-16T16:46:49.886954+02:00
Loading

3 comments on commit 1a07424

@MatthewYaegerTR
Copy link

@MatthewYaegerTR MatthewYaegerTR commented on 1a07424 Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that my org's api_step.extracted_value is receiving a new error when we do deployments since a few days ago with no change to our config:

│ Error: error updating synthetics API test from https://api.datadoghq.com/api/v1/synthetics/tests/api/<test_id>: 400 Bad Request: {"errors":["'extractedValues' value '{'field': '', 'name': '<our_name_value>', 'parser': {'type': 'json_path', 'value': '<our_value>'}, 'secure': False, 'type': 'http_body'}' is invalid"]}

I'm guessing there was a Datadog API change that this provider update is meant to address?

Our config does not have a field key, but I notice that the provider is sending an empty string to the API, which the API does not seem to support any more?

I assume the play here is to update our provider to whatever version has the change in this commit? @Drarig29

@Drarig29
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MatthewYaegerTR! Yes indeed. We are planning to make a patch release of the provider soon.

@MatthewYaegerTR
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Drarig29 for the update.

Please sign in to comment.