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

Invalid KeyRing id format #127

Open
zxpower opened this issue Feb 9, 2021 · 3 comments
Open

Invalid KeyRing id format #127

zxpower opened this issue Feb 9, 2021 · 3 comments
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work

Comments

@zxpower
Copy link

zxpower commented Feb 9, 2021

Overview

When creating KMS keyring binding, I got following error message:

Invalid KeyRing id format, expecting `{projectId}/{locationId}/{keyRingName}` or `{locationId}/{keyRingName}.`

Code used when I got the error below:

module "gha_service_account" {
  source  = "terraform-google-modules/service-accounts/google"
  version = "3.0.1"

  project_id = var.project
  prefix     = "gha"
  names      = ["master-sa"]

  project_roles = [
  ]

  display_name  = "Github Actions SA"
  description   = "Service Account used for Github Actions"
  generate_keys = true
}

module "kms_key_ring-iam-bindings" {
  source  = "terraform-google-modules/iam/google//modules/kms_key_rings_iam"
  version = "6.4.1"
  kms_key_rings = [
    "master-keyring",
  ]
  
  mode = "authoritative"

  bindings = {
    "roles/cloudkms.cryptoKeyDecrypter" = [
      "serviceAccount:${module.gha_service_account.email}",
    ]
  }
}

Solved this by just adding global/ before master-keyring as it was created as global resource.

@morgante
Copy link
Contributor

morgante commented Feb 9, 2021

Since this is solved, I'm not sure we need to do anything to fix in this module.

@zxpower
Copy link
Author

zxpower commented Feb 9, 2021

I suggest to at least update README for the module because by default you don't set the zone for keyrings because they're mostly global, but there could be times when you create region specific keyring.

@morgante morgante added enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work labels Feb 9, 2021
@morgante
Copy link
Contributor

morgante commented Feb 9, 2021

Got it, yes we could update the README. I'm happy to review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3 medium priority issues triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

2 participants