DataDog / terraform-provider-datadog

Terraform Datadog provider
https://www.terraform.io/docs/providers/datadog/
Mozilla Public License 2.0
399 stars 375 forks source link

Synthetic Test In-Place Update Removes config_variable valuable even when `example` value set #2489

Closed GoodmanBen closed 3 weeks ago

GoodmanBen commented 2 months ago

Datadog Terraform Provider Version

v.3.41.0

Terraform Version

v.1.9.2

What resources or data sources are affected?

datadog_synthetics_test

Terraform Configuration Files

resource "datadog_synthetics_test" "stage-external-reachable" {
  ...

  config_variable {
    name    = "EVENT_API_TEST_APP_ID"
    secure  = "true"
    type    = "text"
    example = var.stage_event_api_synthetic_app_id
  }

  config_variable {
    name    = "MY_SECRET_VALUE"
    secure  = "true"
    type    = "text"
    example = var.synthetic_app_secret
  }

  ...
}

Relevant debug or panic output

No response

Expected Behavior

The example/values within the config_variable block should not have been reset on the synthetic test, since the example field is explicitly set.

Actual Behavior

The example/values within the config_variable block were reset after the resource's in-place update. This led to the test failing to run, and an alert being fired.

The terraform plan shows no change in this field during the update.

Screenshot 2024-07-16 at 5 23 44 PM

Steps to Reproduce

No response

Important Factoids

No response

References

No response

Drarig29 commented 1 month ago

Hi @GoodmanBen! Sorry for the delay. Did this bug happen again?

GoodmanBen commented 1 month ago

We have not had any changes to the resource since then, but I would suspect that if any were made going foward it would wipe the pre-set values again.

Drarig29 commented 3 weeks ago

I think you should use the pattern property instead of example. It's meant to initialize the variable's value, then it becomes hidden.

At least, in my case the example property is never used when running the test, so my assertions are failing. On the other hand, pattern is indeed used, so the assertions are passing when using it.

And I couldn't reproduce the fact that "the example/values within the config_variable block were reset after the resource's in-place update".

I'll close this issue. Feel free to reopen with reproducible steps if you manage to reproduce the bug 🙇