1

I'm trying to create a google_kms_key_ring in project b89d. When I run terraform apply, I can see the google_kms_key_ring project field is set to the project I want:

 + resource "google_kms_key_ring" "main_key_ring" {
      + id       = (known after apply)
      + location = "northamerica-northeast1"
      + name     = "key-ring-test"
      + project  = "b89d"
    }

However when I execute this plan, I get the error "Cloud Key Management Service (KMS) API has not been used in project XXXXXXXXX before or it is disabled".

Project XXXXXXXXX is a completely different project. It seems that project b89d that I specified is being ignored. I verified via the GCP console that the KMS API is enabled in the project I want (b89d), but terraform / GCP complains it is not enabled in a different project. How can I fix this?

I can see in the terraform logs, it submits the correct url:

POST /v1/projects/b89d/locations/northamerica-northeast1/keyRings?alt=json&keyRingId=key-ring-test HTTP/1.1

I don't know why it's complaining about the API being enabled in a different project.

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.