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

Error with crn parser in SCC DA #241

Open
jor2 opened this issue Dec 13, 2024 · 1 comment
Open

Error with crn parser in SCC DA #241

jor2 opened this issue Dec 13, 2024 · 1 comment
Assignees

Comments

@jor2
Copy link
Member

jor2 commented Dec 13, 2024

kms module has this count condition:

  count                       = var.existing_scc_cos_kms_key_crn != null || var.existing_scc_cos_bucket_name != null || var.existing_scc_instance_crn != null ? 0 : 1 # no need to create any KMS resources if passing an existing key or bucket, or SCC instance

If you pass a value for existing_scc_cos_bucket_name the count is 0 and no kms module is used. The CRN condition appears to be wrong and needs a rethink of the logic:

module "existing_kms_key_crn_parser" {
  count   = var.existing_scc_cos_kms_key_crn != null || var.existing_kms_instance_crn != null ? 1 : 0
  source  = "terraform-ibm-modules/common-utilities/ibm//modules/crn-parser"
  version = "1.1.0"
  crn     = var.existing_scc_cos_kms_key_crn != null ? var.existing_scc_cos_kms_key_crn : module.kms[0].keys[format("%s.%s", local.scc_cos_key_ring_name, local.scc_cos_key_name)].crn
}

No kms module is used but it still attempts to reference it if var.existing_scc_cos_kms_key_crn == null.

You get this error

 2024/12/12 21:39:13 Terraform plan | Error: Invalid index
 2024/12/12 21:39:13 Terraform plan | 
 2024/12/12 21:39:13 Terraform plan |   on main.tf line 42, in module "existing_kms_key_crn_parser":
 2024/12/12 21:39:13 Terraform plan |   42:   crn     = var.existing_scc_cos_kms_key_crn != null ? var.existing_scc_cos_kms_key_crn : module.kms[0].keys[format("%!s(MISSING).%!s(MISSING)", local.scc_cos_key_ring_name, local.scc_cos_key_name)].crn
 2024/12/12 21:39:13 Terraform plan |     ├────────────────
 2024/12/12 21:39:13 Terraform plan |     │ module.kms is empty tuple

source code is here

@kierramarie
Copy link
Contributor

Provider issue: IBM-Cloud/terraform-provider-ibm#5890

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants