-
Notifications
You must be signed in to change notification settings - Fork 101
Open
Labels
P3medium priority issuesmedium priority issuesbugSomething isn't workingSomething isn't workingtriagedScoped and ready for workScoped and ready for work
Description
How do I import existing keyring to this module?
I have some terraform code:
module "kms-keys" {
source = "terraform-google-modules/kms/google"
version = "~>2.0"
project_id = module.project.project_id
keyring = var.kms_keyring_name
location = var.kms_keyring_location
key_algorithm = "GOOGLE_SYMMETRIC_ENCRYPTION"
key_protection_level = var.kms_key_protection
keys = tolist([var.kms_gke_key_name])
prevent_destroy = false
}
And I have a keyring named "main-keyring". I'm trying to import state like this:
terraform import "module.kms-keys.google_kms_key_ring.key_ring" "myproject-631c/europe-west3-a/main-keyring"
And I'm getting an error:
module.kms-keys.google_kms_key_ring.key_ring: Refreshing state... [id=projects/myproject-631c/locations/europe-west3-a/keyRings/main-keyring]
╷
│ Error: Invalid function argument
│
│ on .terraform/modules/kms-keys/main.tf line 18, in locals:
│ 18: keys_by_name = zipmap(var.keys, var.prevent_destroy ? slice(google_kms_crypto_key.key[*].self_link, 0, length(var.keys)) : slice(google_kms_crypto_key.key_ephemeral[*].self_link, 0, length(var.keys)))
│ ├────────────────
│ │ var.keys is list of string with 1 element
│
│ Invalid value for "end_index" parameter: end index must not be greater than the length of the list.
Is it a bug?
philicious, chicocvenancio, mugioka, 27Bslash6, jumpeiMano and 2 more
Metadata
Metadata
Assignees
Labels
P3medium priority issuesmedium priority issuesbugSomething isn't workingSomething isn't workingtriagedScoped and ready for workScoped and ready for work