为嵌套对象创建 Terraform 变量

Creation of Terraform Variables for Nested Objects

以下是我们云中使用的我的 terraform 模块的变量声明,这些变量的输入是通过一种自动化解决方案获得的。现在,我想重现我想从以下变量定义创建 tfvars 文件的问题之一。

variables.tf:

variable "docker" {
  type = object({
    image_name    = string
    image_location = string
    docker_ports = object({
      internal = number
      external    = number
    })
    rmodelling = object({
      lang  = object({
        version = number
        enabled    = bool
        policy = object({
          identification = string
        })
      })
      impl = object({
        version   = number
        enabled      = bool
        policy = object({
          identification = string
        })
      })
    })
  })
}

我已经尝试过类似的方法,但是对于下一个嵌套对象,我不太确定如何放下它们。有人可以指导或指导一下吗?

terraform.tfvars:

docker = {
  image_name = "Ubuntu 18.04"
  image_location = "https://registry.jd.com/ubuntu/<custom_location>"
  docker_ports = {
    internal = 80
    external = 443
  }
rmodelling = { ??
???

var.docker 的有效值示例是:

docker = {
  image_name = "Ubuntu 18.04"
  image_location = "https://registry.jd.com/ubuntu/<custom_location>"
  docker_ports = {
    internal = 80
    external = 443
  }
  rmodelling = { 
      lang = {
            version = 3
            enabled = true
            policy = {
              identification = "test"
            }
      }
      impl = {
        version = 4
        enabled = false
        policy = {
          identification = "test2"
        }      
     }       
  }    

}