Terraform basic course, lab "Resource Dependencies"

Hello,

For exercise n. 6 I thought I had to use interpolation dependency
image

But in the solution the variable/resource is called in the normal way, dotted notation

I see it works the same way. From the theory point of view, is there any difference?
Thanks in advance.

Hi @Mundofik

Both work the same way, the way I see it is based on the context where it’s been used. If you only need the variable’s value directly, I use reference expressions, (for example var.example), it’s simpler and preferred. String interpolation (${var.example} ) is only necessary and useful when you’re combining the variable with other text, like "${var.example}-foo .

In pure value assignments, both forms are same, but using interpolation without a need for string manipulation is redundant.

Thank you very much!