Skip to content

Ability to create custom types. #27365

@adamdonahue

Description

@adamdonahue

Instead of something like this:

module-inputs.tf

variable "configuration" {
  type = object({
      x = string
      y = string
      z = list(string)
   })
}

infra-inputs.tf

variable "named-configurations" {
  type = map(
    object({
      x = string
      y = string
      z = list(string)
   })
  )
}

which, here and especially for multiple top-level modules, involves a ridiculous amount of boilerplate, we'd like to see something along the lines of:

types.tf

type "configuration" {
  definition = map(
    object({
      x = string
      y = string
      z = list(string)
   })
  )
} 

and then

module-inputs.tf

variable "configurtion" {
  type = types.configuration
}

infra-inputs.tf

variable "named-configurations" {
  type = map(types.configuration)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions