Need a way to toggle label_key_case context

Before I went off to develop a method I thought I would reach out and ask for some help/ guidance. Here’s the situation;

  1. I have a unique scenario where the IAM role needs to have the “Name” = Value be all capitalized to match the AD naming schema requirement. (i.e., SERVICE-TEAM-ROLE )
  2. I am using terraform-null-label module for everything and have the name = module.custom_role_label where I can format this name specifically. This is the only change I make to the core labeling of the entire terraform code. Everything else is namespace-name-state-attributes.

Is there an easy way to tell the module label that I want name = example-role to be explicitly all capitalized? As the module dictates, its converted to lower case for all values if you do not set a label_key_case. I do not want everything to be capitalized, I only need the name for this specific role to be capitalized.

 Error: Unsupported argument

  on main.tf line 27, in module "adfs_role_label":
  27:   label_key_case   = "title"

An argument named "label_key_case" is not expected here.


Error: Unsupported argument

  on main.tf line 28, in module "adfs_role_label":
  28:   label_value_case = "upper"

An argument named "label_value_case" is not expected here.

What is the best way to isolate this one role but keep everything else default to its labeling structure?

// LABEL FOR ADFS ROLE
module "adfs_role_label" {
  source = "../.."
  label_order = ["name"]
  enabled    = "true"
  name       = "ADFS-TEST-QA"

  label_key_case   = "title"
  label_value_case = "upper"

}

// LABEL CONTEXT FOR ADFS ROLE
module "adfs_role_label_context" {
  source = "../.."

  context = module.adfs_role_label.context
}
// ENSURE ADFS ROLE MAY ASSUME ROLE
resource "aws_iam_role" "adfs_role" {

  max_session_duration = var.max_session_duration
  assume_role_policy = data.aws_iam_policy_document.assume_role_policy.json
  tags = module.this.tags

  context = module.adfs_role_label_context.context
}

This is an interesting use-case and it makes sense what you’re trying to do. Unfortunately, we don’t support selectively manipulating the case for an individual tag.

I suggest opening an issue to see if we can collect support for it. In the meantime, the best workaround I think suggest would be using a local and doing your own transformations there.