Skip to content
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

Cannot update all datadog_integration_gcp fields #269

Closed
pdecat opened this issue Jul 24, 2019 · 3 comments
Closed

Cannot update all datadog_integration_gcp fields #269

pdecat opened this issue Jul 24, 2019 · 3 comments

Comments

@pdecat
Copy link
Contributor

pdecat commented Jul 24, 2019

The only field of datadog_integration_gcp that can be updated is host_filters: https://github.com/zorkian/go-datadog-api/blob/v2.21.0/integrations.go#L235

All other fields should then be marked as ForceNew.

Also, it should be worth noting that the GCP integration has to first be manually enabled in the Datadog web console: https://myaccount.datadoghq.com/account/settings#integrations/google-cloud-platform

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

terraform -v

Terraform v0.12.5

  • provider.datadog v2.0.2
  • provider.google v2.11.0

Affected Resource(s)

  • datadog_integration_gcp

Terraform Configuration Files

data "google_service_account" "sa" {
  account_id = var.gcp_service_account_id
  project    = var.gcp_project_id
}

resource "google_service_account_key" "sak" {
  service_account_id = data.google_service_account.sa.name
}

resource "datadog_integration_gcp" "integration" {
  project_id     = var.gcp_project_id
  private_key_id = split("/", google_service_account_key.sak.id)[5]
  private_key    = jsondecode(base64decode(google_service_account_key.sak.private_key))["private_key"]
  client_email   = data.google_service_account.sa.email
  client_id      = data.google_service_account.sa.unique_id
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

What should have happened?

Modifying any field other than host_filters should trigger a replacement of the integration as these cannot be read and/or updated.

Actual Behavior

What actually happened?

The update seems to happen in the state but no change happen on the datadog side.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
  2. terraform taint module.datadog-integration-cloud-gcp.google_service_account_key.sak
  3. terraform apply

Produces the following plan:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # module.datadog-integration-cloud-gcp.datadog_integration_gcp.integration will be updated in-place
  ~ resource "datadog_integration_gcp" "integration" {
        client_email   = "[email protected]"
        client_id      = "123456789"
        host_filters   = ""
        id             = "xxxxx"
      ~ private_key    = (sensitive value)
      ~ private_key_id = "bb71815591d4c63510e3a0e018179ef98c3d85dc" -> (known after apply)
        project_id     = "xxxxx"
    }

  # module.datadog-integration-cloud-gcp.google_service_account_key.sak is tainted, so must be replaced
-/+ resource "google_service_account_key" "sak" {
[...]
    }

Using TF_LOG=trace, we can see the request made to the Datadog API does nothing:

2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: ---[ REQUEST ]---------------------------------------
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: POST /api/v1/integration/gcp/host_filters?api_key=xxxxx31b6041d1&application_key=xxxxx HTTP/1.1
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: Host: app.datadoghq.com
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: User-Agent: Go-http-client/1.1
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: Content-Length: 153
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: Content-Type: application/json
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: Accept-Encoding: gzip
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4:
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: {
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4:  "project_id": "xxxxx",
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4:  "client_email": "[email protected]",
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4:  "host_filters": ""
2019-07-24T14:49:54.616+0200 [DEBUG] plugin.terraform-provider-datadog_v2.0.2_x4: }

Important Factoids

N/A

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

  • N/A
@pdecat
Copy link
Contributor Author

pdecat commented Dec 6, 2019

Still current with go-datadog-api v2.25.0:

https://github.com/zorkian/go-datadog-api/blob/v2.25.0/integrations.go#L325-L328

@pdecat
Copy link
Contributor Author

pdecat commented Dec 6, 2019

@pdecat pdecat changed the title Most datadog_integration_gcp fields should be ForceNew Allow updating all datadog_integration_gcp fields Dec 6, 2019
@pdecat pdecat changed the title Allow updating all datadog_integration_gcp fields Cannot update all datadog_integration_gcp fields Dec 6, 2019
@pdecat
Copy link
Contributor Author

pdecat commented Jan 21, 2020

Fixed in v2.6.0 by #394.

@pdecat pdecat closed this as completed Jan 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant