We want to add the capabilities to create JS assertions with terraform
[!Important]
Because the javascript assertion does not contains any operator, we need to make the operator field of an assertion Optional.
Because we cannot validate a field based on another field in schema right now, it means we cannot make the operator optional only if type is javascript and make it required otherwise.
This implies that we cannot validate anymore if the user forgot to add an operator for a non javascript assertion, and terraform will still perform the request to dogweb and then display the validation error from dogweb.
But we still have the operator validation, meaning terraform will fail if the user provide a wrong operator value
Now, we have thew options to deal with this issue:
Do nothing about it, and let the terraform accept an assertion with no operator (other than javascript assertion) and then display the error from dogweb :
{"errors":["'assertions' value '{'operator': '', 'target': 2000, 'type': 'responseTime'}' is invalid"]}
Add an special operator for this kind of case where we don't really need any operator, such as noOperator or something like this. This would require a lot of work in the worker, frontend and api spec because we already created a bunch of type for this assertion assuming there is no operator
Create a new schema for assertion without operator so we still have the required operator for regular assertions, and no operator for the js assertion, for example:
SYNTH-14849
Context
We want to add the capabilities to create JS assertions with terraform
Now, we have thew options to deal with this issue:
javascript
assertion) and then display the error from dogweb :noOperator
or something like this. This would require a lot of work in the worker, frontend and api spec because we already created a bunch of type for this assertion assuming there is no operatorChange
NewSyntheticsAssertionJavascriptTypeFromValue
value to validate the assertiontype
valuecode
field to the assertionoperator
field to optionalbuildDatadogAssertions
to create javascript assertionbuildTerraformAssertions
to handle javascript assertionQA
Tested locally with the provider and it works