terraform-provider-maas icon indicating copy to clipboard operation
terraform-provider-maas copied to clipboard

provide an option to use data source by systemid

Open marosg42 opened this issue 1 year ago • 0 comments

As discussed with @skatsaounis something like this would be handy

resource "maas_tag" "foundation_nodes" {
  name = "foundation-nodes"
}

data "maas_machine" "machines" {
  for_each = maas_tag.foundation_nodes.machines
}

Currently it errors with

$ terraform import maas_tag.foundation_nodes foundation-nodes
maas_tag.foundation_nodes: Importing from ID "foundation-nodes"...
maas_tag.foundation_nodes: Import prepared!
  Prepared maas_tag for import
maas_tag.foundation_nodes: Refreshing state... [id=foundation-nodes]
╷
│ Error: Invalid combination of arguments
│ 
│   with data.maas_machine.machines["4f8b7c"],
│   on /home/ubuntu/project/generated/sunbeam/generated.tf line 24, in data "maas_machine" "machines":
│   24: data "maas_machine" "machines" {
│ 
│ "pxe_mac_address": one of `hostname,pxe_mac_address` must be specified
╵

╷
│ Error: Invalid combination of arguments
│ 
│   with data.maas_machine.machines["4f8b7c"],
│   on /home/ubuntu/project/generated/sunbeam/generated.tf line 24, in data "maas_machine" "machines":
│   24: data "maas_machine" "machines" {
│ 
│ "hostname": one of `hostname,pxe_mac_address` must be specified
╵
...

marosg42 avatar Feb 19 '24 08:02 marosg42