-
Notifications
You must be signed in to change notification settings - Fork 381
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
datadog_integration_pagerduty breaks expected terraform contract, allows for creating same resource twice #564
Comments
Thanks for the great explanation. The integration resource is effectively a singleton, so the fit into terraform is tricky indeed. I'm thinking that we could disable deletion of the resource anyway. The main point is to delete the services behind, but if |
I've opened up a MR to address the above issue: https://github.com/terraform-providers/terraform-provider-datadog/pull/565 My thought process was to include an optional flag to enforce that the integration wouldn't be deleted if it already exists for backward compatibility. It feels like that should be the default option but wanted to ease folks in. |
Doesn't your PR raise an error if the integration exists? It seems that 1) It's prone to race condition 2) It will fail to update if the subdomain changes. I think I'd favor a flag that ignore deletion. |
I talked to the team responsible for that endpoint, and it looks like this is some legacy resource. Apparently you shouldn't need that resource at all, as the integration is now setup via web hooks in PagerDuty. You can use the service resource to manage services, but the main resource isn't required. We need to update the documentation to cover that, but does that makes sense @geota? |
@therve Yes it'll currently throw an error if the integration exist but just ignoring deletion makes sense. That seems to be an easy enough to accommodate in the PR. |
I think the first step is to remove the deletion, and to deprecate the resource. Then update documentation to remove the reference to that resource. |
@therve Removing the deletion, deprecating the resource, and clearly updating the docs seems sufficient imho. |
Terraform Version
Affected Resource(s)
Please list the resources as a list, for example:
Terraform Configuration Files
test/module_a/main.tf
test/module_b/main.tf
Debug Output
Module a
Module b
Expected Behavior
Terraform datadog provider should fail to create the resource a second time. Terraform datadog provider should not implicitly adopt or recreate the existing datadog_inteegration_pagerduty resource.
Actual Behavior
Terraform silently succeeds to create and/or implicitly imports the resource even though it already exists. This leads to a shared resource with no implicit action taken by the user to acknowledge it is a shared resource. This then leads to unexpected behavior when the resource is deleted by one of the terraform modules causing the shared resource gets deleted across all of the dependencies which can have wide-ranging impact in a large organization (it will delete all the PD / Datadog integration service entries and leads to ops team flying blind).
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
The text was updated successfully, but these errors were encountered: