terraform-provider-datadog
terraform-provider-datadog copied to clipboard
Provider produced inconsistent result after apply with datadog_integration_gcp and project_id as empty string
Hi there,
Trying to create DataDog / GCP integration with empty project_id (Service Account Impersonation and Autodiscovery) using terraform returns error. The obvious difference is that the required parameter "project_id" provided is empty stirng.
Terraform Version
_$ terraform -v
Terraform v1.2.4
...
+ provider registry.terraform.io/datadog/datadog v3.12.0
...
Affected Resource(s)
- datadog_integration_gcp
Terraform Configuration Files
locals {
service_account_key_str = var.service_account_key == null ? var.service_account.private_key : var.service_account_key
service_account_key = jsondecode(base64decode(local.service_account_key_str))
}
resource "datadog_integration_gcp" "instance" {
client_email = var.service_account.email
client_id = local.service_account_key.client_id
private_key = local.service_account_key.private_key
private_key_id = local.service_account_key.private_key_id
project_id = ""
}
terraform {
required_providers {
datadog = {
source = "DataDog/datadog"
}
}
}
Debug Output
No Debug Output
Panic Output
No panic produced
Expected Behavior
Apply successfully the code, store the result in the state file and not to generate error messages
Actual Behavior
Applies the change at DD (the resource is visible in DD web interface), however the resource is not added to the state file (on next run the resource "Conflict" error message appears) and the error message is generated:
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to module.datadog.module.datadog_gcp.datadog_integration_gcp.instance, provider
│ "provider[\"registry.terraform.io/datadog/datadog\"]" produced an unexpected new value: Root resource was present, but now absent.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
Steps to Reproduce
terraform apply
Important Factoids
Running the same code second time generates "Conflict" error message:
╷
│ Error: error creating GCP integration from https://api.datadoghq.eu/api/v1/integration/gcp: 409 Conflict: {"errors":["This Service account already exists in your Datadog account."]}
│
│
│ with module.datadog.module.datadog_gcp.datadog_integration_gcp.instance,
│ on ../../module/datadog/gcp/main.tf line 7, in resource "datadog_integration_gcp" "instance":
│ 7: resource "datadog_integration_gcp" "instance" {
│
╵
References
No references.