Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow selection or filter of element(s) from a set result #26698

Closed
MikeWhittakerRyff opened this issue Oct 24, 2020 · 2 comments
Closed

Allow selection or filter of element(s) from a set result #26698

MikeWhittakerRyff opened this issue Oct 24, 2020 · 2 comments

Comments

@MikeWhittakerRyff
Copy link

MikeWhittakerRyff commented Oct 24, 2020

When a data source returns a set result, it would be most useful to be able to access the result in some selective manner.
Example below, from the AMI I want to read the device_name in order to customise the root device size, but the *.block_device_mappings is a set, so I cannot do so.

The set cannot be indexed, or selected, so we have no way to filter out or access the value of device_name of the root device.

In this case, I would eg select the element in which ebs is not "{}" - or a synonym element with .root attribute would be handy.

eg

when

output "volume_mappings" {
  value = "${local.ami_type.*.block_device_mappings}"
}


returns

    {
      "device_name" = "/dev/sda1"
      "ebs" = {
        "delete_on_termination" = "true"
        "encrypted" = "false"
        "iops" = "0"
        "snapshot_id" = "snap-0290d1d1b92a0cf6d"
        "volume_size" = "8"
        "volume_type" = "gp2"
      }
      "no_device" = ""
      "virtual_name" = ""
    },
    {
      "device_name" = "/dev/sdb"
      "ebs" = {}
      "no_device" = ""
      "virtual_name" = "ephemeral0"
    },
    {
      "device_name" = "/dev/sdc"
      "ebs" = {}
      "no_device" = ""
      "virtual_name" = "ephemeral1"
    },
  ],
@MikeWhittakerRyff MikeWhittakerRyff added enhancement new new issue not yet triaged labels Oct 24, 2020
@pkolyvas pkolyvas added config and removed new new issue not yet triaged labels Oct 26, 2020
@pkolyvas
Copy link
Contributor

Thanks for the submission @MikeWhittakerRyff. While we aren't planning on working on this is the near term, it would be a valuable addition to Terraform.

I'm going to close this as a duplicate of #19931.

@ghost
Copy link

ghost commented Nov 26, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked as resolved and limited conversation to collaborators Nov 26, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

2 participants