Tag name (key) is converted to lowercase

Still playing with Terraspace

No issue to apply Resources Tags on Azure but I need to respected some naming convention on the tags

This is my azurerm config:

config/plugins/azurerm.rb

TerraspacePluginAzurerm.configure do |config|
  config.auto_create = true # set false to disable auto creation
  config.resource_group.update_existing = true

  config.tags = {
    :TS_ENV => Terraspace.env,
    :Terraspace => true,
    "Created?\u{5F}_By" => "fffff",
    :_Supported__By => "vasd",
    :_Environment => ENV['TAG_BACKEND_ENVIRONMENT'],
    :_Owner => "C",
    :_Application__Code => "A",
    :_Application_Name => "IASD",
  }

end

I tried a bunch of syntax (as you can see on my config) but I cannot have my keys correctly inputted in my Azure Tags
I notice that if I put an underscore before a letter, the letter become an uppercase
I try to escape the underscore character, with slash or double the underscore, nothing works.
I would like to have something like this:

Upper case for each word and each word are separated by an underscore

config.tags = {
    :TS_ENV => Terraspace.env,
    :Terraspace => true,
    "Created_By" => "fffff",
    :Supported_By => "vm",
    :Environment => ENV['TAG_BACKEND_ENVIRONMENT'],
    :Owner => "C",
    :Application_Code => "A",
    :Application_Name => "IE",
  }

Instead I always got all my keys in lowercase and the first letter in upper case if I have a underscore right before the letter.
[IMAGE REMOVED as I’m a new user … i cannot insert :/]

I tried to find any article related to this issue but my only clue was this github issue for Pulumi
Tag name is converted to lowercase · Issue #430 · pulumi/pulumi-terraform (github.com)

Thanks

Hi @tung,

I found the issue but I need your output regarding the gems armrest-0.1.2 source code…

I would like to know why you “camelize” the “data” variable
It screws all the tags keys… if I comment the line 67, the tags on Azure is ok
So wondering if there is a particular reason that you camelize the data ?

Can you publish a new version without camelize? (as I got an Azure Policy so I need to respect the naming convention.)

I would also like to know why you didn’t use this gems: azure-armrest-0.13.1
Is it because it cannot handle MSI? (Maybe yes but I didn’t check)
They released a new version last month
(Sorry I cannot put more than 2 links as I’m “still” a new user)

Thanks

I see. The reason why camelize(:to_lower) or pasalCase was being called is because a lot of the azure api data expects the keys like this. However, like you mentioned, it messes up tags.

Instead of automatically pascalCasing, updated the terraspace_plugin_azurerm to explicitly use pascalCase now. And removed auto pascalCasing in the armrest library. Related:

This should address the issue with tags. Thanks for the report. To update, in the terraspace project

bundle update 

RE: Why didn’t use azure-armrest gem

Tried it. Think considered modifying that one. Don’t remember exactly why it didn’t work for terraspace_plugin_azurerm. It didn’t have MSI also. Built armrest and moved on. Will consider it if someone wants to take another look.