There are two problems here. One of them was correctly identified by @fortman: the
[*] splat syntax follows the precedent of the index syntax (like
) and doesn’t use a leading dot marker.
The second problem is that you cannot dynamically select instances like that. A minimal reference to a resource must always include a resource name, like
aws_instance.foo. You can then apply any arbitrary traversal operators to that, such as using the splat operator to map over all of the instances of a particular resource:
value = [aws_instance.example[*].id]
If you have a set of resources that are related such that you will use them together then you can either represent them all as a single resource using
count (assuming they are essentially just multiple copies of the same concept) or you must construct manually the list of specific resources you want to include:
value = concat(
Terraform uses these references to decide the order of operations in the execution plan, which is why it requires you to select specific resources statically by name rather than making dynamic selections by expressions. This is one of the implementation/design tradeoffs of Terraform’s declarative model.