Hi @jcardoso-bv! Thanks for sharing the additional context, and I’m glad you figured it out.
The clue in what you shared was the square brackets around the value of the
globalaccelerator_ip_addresses output, which suggests that
ip_sets is a list of objects rather than a single object. That’s presumably to allow for the possibility of multiple
ip_sets blocks, which is a common way to represent blocks in expressions.
 here you selected the first (and, in this case, only) element of that list, and then accessed the
ip_addresses attribute of that object.
In general, when a particular block type supports multiple block instances, it behaves like a resource with
count set, in that it appears as some sort of collection value in expressions. The documentation section References to Resource Attributes talks about this some more, and also gives some general patterns that should work for all block types, regardless of how exactly they are represented in the data structure. The advice there leads to a different way to get a similar result:
records = flatten(aws_globalaccelerator_accelerator.example.ip_sets[*].ip_addresses)
[*] here is a shorthand for accessing the
.ip_addresses attribute for each block, returning a list of those values. Since
ip_addresses is already a list, that gives a list of lists, which we then flatten down into a single list using the
flatten function here. The result then is the same as you had before in this situation where there’s only one
ip_sets block, but if there were more than one block then it would collect all of the IP addresses from all of the blocks and use them all together.
Both of these approaches are equally valid here, and the distinction only matters if you might have multiple
ip_set blocks and thus need to decide whether to take the IP addresses only from the first one or from all of them.