google-cloud-platformterraformterraform-provider-gcpgoogle-cloud-dlp

try to create dlp template using terraform in a project but it ask me to activate dlp on another


I'm trying to create dlp template using terraform in a project but it asks me to activate dlp in another one.

here is the code I submitted :

resource "google_data_loss_prevention_inspect_template" "mytemplate" {
  parent       = "projects/${local.project_id}/locations/europe-west1"
  description  = "Custom Template"
  display_name = "Custom Template"

  inspect_config {
    custom_info_types {
....

I'm authenticated with json.key file (using GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the key)

I got the error : Error: Error creating InspectTemplate: googleapi: Error 403: Cloud Data Loss Prevention (DLP) API has not been used in project XXXXX before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/dlp.googleapis.com/overview?project=XXXXX then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.

where project XXXXX is the one associated with my service account and not the one defined in the resource.

I tried to force project in google provider too, but same result.


Solution

  • The service account's owning project does need to have DLP enabled.