Skip to content

Outputs produces unnecessarily multidimensional objects #31

Closed
@cosmindev

Description

@cosmindev

Output variables in the format of unnecessarily multidimensional arrays which are hard to query by other tf code using this module:

  • output code example:
    output "public_ip" { description = "Public IPs of created instances. " value = ["${module.instance.public_ip}"] }
  • generated output:
    public_ip = [ [ "132.145.XX.YY", "132.145.XX.YY", ], ]
  • Example usecase: remote exec connection blocks

provisioner "file" {   connection {     user        = "opc"     agent       = false     private_key = "${chomp(file(var.ssh_private_key_path))}"     timeout     = "10m"     host        = "${module.instance.public_ip[count.index]}"   }     source      = "apache_install.sh"   destination = "/tmp/apache_install.sh" }

the above syntax for getting the host public IP it will not work with multidimensional arrays and it will require unnecessarily complex element()/lookup() functions usage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions