v0.23.0 pre-release: Allow control of letter case of outputs
Pre-releaseKnown issues
- Does not interoperate with earlier versions of
null-label. The canonicalcontext = module.this.contextfails ifmodule.this.contextis an older version context.tfdoes not incorporatevar.label_key_caseandvar.label_value_caseinto themodule.thisobject, preventing those variables from taking effect in the root module'smodule.this.
feat: add support for setting letter case of context tags @SweetOps (#107)
With this release, you gain control over the letter case of generated tag names and supplied labels, which means you also have control over the letter case of the ultimate id.
Labels are the elements you can include in label_order, namely namespace, environment, stage, name, and attributes. For every non-empty label, a corresponding tag name is generated. For namespace, environment, stage, the output is the formatted, normalized input. (By "normalized" we mean that it goes through regex_replace_chars.), For attributes, which is a list, each element is normalized, duplicates are removed, and the resulting list is converted to a string by joining the elements with the delimiter (defaults to hyphen). For name, which is special, the output is the same as id, which is the joining of the labels in the order specified by label_order and separated by delimiter.
- You can set
label_key_caseto one ofupper,lower, ortitle, which will result in generatedtagnames in the corresponding case:NAME,name, orName. For backwards compatibility,titleis the default - You can set
label_value_caseto one ofupper,lower,title, ornone, which will result in output label values in the corresponding case (withnonemeaning no case conversion of any kind will be done, though the labels will still be subject toregex_replace_chars). The case converted labels will show up not just in the module output of the labels themselves, but also in thetagvalues and in theidstring.
You can look at the test cases in examples/complete and the expected results in test/src/examples_complete_test.go to see examples of how this is supposed to work.
One interesting example is that you can create ids in Pascal case by setting label_value_case = "title" and delimiter = "".