How to reference/use the set() type variable values in a particular 'resource'?

In the 'Terraform Basics Training course, there is a chapter ‘Understanding the Variable Block’ , in this vdo, it is explained how to define set() type of variables, for ex: type = set(string) and how it differs with type ‘list’, etc.
There is no explanation of how to use those set() type variable values in a particular ‘resource’ in the main.tf file.
We cannot use it like ‘list’ type variable for ex: var.variablename[index] in a particular ‘resource’. Request to update the vdo to include the explanation.
For now, can someone please help me explain how to use/reference the set() type variable values in a particular ‘resource’ ?

In computer science, a set is a collection of unique values. Terraform is no different in this respect.

Sets serve to guarantee uniqueness of objects. If a user of your configuration is allowed to supply a list of something as input, and the user supplied the same value twice, this may cause an issue for your configuration.
By converting a list to a set (with to_set) you will automatically eliminate duplicates.

You cannot index a set (i.e. using [ ]). You iterate it with for or for_each
You can also convert it back to a list (which will now contain unique values only, and can be indexed) with to_list

If you convert a list to a set and back to a list, you are guaranteed uniqueness, but not guaranteed the items will be in the same order, because the terraform implementation of a set is unordered.

Hello Alistair,
Thanks for the response and explanation related to set() type of variables. Yes its been clear from the vdo itself that set is a collection of unique values.
My main question was how to use those values of set() variable in the ‘resource’ block within main.tf file? As the vdo explains how to use the values of list() type variable(using var index), similar explanation for set() is missing in the vdo.

Thanks for mentioning that we need to iterate it with for or for_each . I have then read about for_each further on this link: Terraform for_each: A simple tutorial with Examples and have understood it.
Thanks again.