Hello
May be I do something complete wrong but is there any way to collect one variable of resources to list.
I have very simple custom provider for solarwinds ipam to set/remove IP reservation which have one resource swm_ip_reservation with several arguments (ipam host, user, password, vlan, etc…) and one Computed argument ip_addr - which populated by provider after successful IP reservation.
Like this in provider code:
"ip_addr": &schema.Schema{
Type: schema.TypeString,
Computed: true,
I need to put this output variables of module and while this work for one resource it doesn’t work for several.
Simple tf for test:
output managed_ip {
value = swm_ip_reservation.test1[*]
}
variable hosts {
type = set(string)
default = ["host1.example.com", "host2.example.com"]
}
resource "swm_ip_reservation" "test1" {
for_each = var.hosts
ipam_user = "user"
ipam_pass = "password"
ipam_host = "ipam.example.com"
vlan = 123
hostname = each.key
}
In this case I have all values from resource including computed value. If I change output to swm_ip_reservation.test1["host1.example.com"].ip_addr
terraform successfully returns output variable with only ip_addr.
Changing to swm_ip_reservation.test1[*].ip_addr
gives me error:
Error: Unsupported attribute
on main.tf line 2, in output "managed_ip":
2: value = swm_ip_reservation.test1[*].ip_addr
This object does not have an attribute named "ip_addr".
Tried different approaches to convert however I think I missing something