Issue defining Object with attribute name containing a ":"

In one of my modules I define an input variable with a type of `object’. One of the attributes needs to have a “:” in it. So the object would like something like:

variable "appSettings" {
  type = object({
    config1 = string
    config2 = string
    serviceConfig:apiUrl = string
  })
}

I can understand why that’s not directly possible but is there some way of escaping the colon? In Azure App Services nested configuration must use “:” to denote hierarchy. For example, serviceConfig:apiUrl would be equivalent to a configuration file like:

{
    config1: true,
    config2: false,
    serviceConfig {
        apiUrl: "somedomain.com"
    }
}

So I definitely need this, is there a way around this limitation?

Attributes must be valid identifiers themselves, so there is no way to escape the colon here. If all the values are strings, you can use a simple map(string) which allows any valid string as the key.

If the object needs to be extended with other attribute types, you can also choose to keep the structure of the hierarchy intact by making serviceConfig an attribute of type map(string) (or even a more complex object). This also may allow you to be able to pass a conforming resource instance as the variable input rather than constructing bespoke values.

Great, I’ll give that a go. Thanks!