DataDog / terraform-provider-datadog

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

[datadog_api_key] Stop overwriting key values in state when the API omits the key #2544

Closed tyjet closed 2 months ago

tyjet commented 2 months ago

When updating or importing API key resources, if the Datadog API does not include the optional computed key field, then the field is overwritten with an empty string in terraform state. The key is immutable so it does not need to be updated once it has been initially set.

Added a check to ensure the field is set before writing it into the response.

Tested manually via integration test against API responses with and without the key field. Updated unit test to match new behavior and not depend on the API returning an optional field.

jack-edmonds-dd commented 2 months ago

/merge

dd-devflow[bot] commented 2 months ago

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in master is 1m.

Use /merge -c to cancel this operation!

dd-devflow[bot] commented 2 months ago

:x: MergeQueue: This merge request is not mergeable, blocked by github

PR can't be merged according to github policy. It's probably because:

If you need support, contact us on Slack #devflow with those details!

jack-edmonds-dd commented 2 months ago

/merge

dd-devflow[bot] commented 2 months ago

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in master is 1m.

Use /merge -c to cancel this operation!

dd-devflow[bot] commented 2 months ago

:x: MergeQueue: This merge request is not mergeable, blocked by github

PR can't be merged according to github policy. It's probably because:

If you need support, contact us on Slack #devflow with those details!

jack-edmonds-dd commented 2 months ago

/merge

dd-devflow[bot] commented 2 months ago

:steam_locomotive: MergeQueue: pull request added to the queue

The median merge time in master is 1m.

Use /merge -c to cancel this operation!