terraform-google-modules / terraform-docs-samples

Terraform samples intended for inclusion in cloud.google.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KMS KeyRing Issues

msampathkumar opened this issue · comments

TL;DR

For google_kms_key_ring resources are failing CICD tests, when its name is not unique.

For example:

resource "google_kms_key_ring" "keyring" {
  name     = "keyring-name"
  location = "us-central1"
}

will fail a CICD tests, just as found at #503 (comment) with KMS error: keyring-name already exists

During the CICD, a keyring is created and deleted multiple times. When a resource is archived or reserved this error can be expected.

https://github.com/search?q=repo%3Aterraform-google-modules%2Fterraform-docs-samples+resource+%22google_kms_key_ring%22&type=code

Expected behavior

Two way this issue can be fixed

  1. Using a random prefix or suffix

     resource "random_id" "default" {
       byte_length = 8
     }
    
     resource "google_kms_key_ring" "keyring" {
     name     = "keyring-name-${random_id.default.hex}"
     location = "us-central1"
     }
    
  2. Skipping CICD tests

Files to update

Observed behavior

No response

Terraform Configuration

NA

Terraform Version

NA

Additional information

No response