If you are creating clusters based on the value of var.count, I think implementing for_each is not necessary since var.count will always force the traversal to be a counter e.q. it will start from 0, then 1, then 2 ...etc. So this will ensure your infrastructure will be idempotent. But if you are still keen to use for_each, you will have to convert your var.count into a list then convert it to a set: for_each = toset(range(var.count)) That in itself is already an unnecessary calculation in the code.
I had issues in the past (not sure if it has been fixed) where terraform sets the execution mode to Remote by default which stops me from running terraform locally. My wrapper script sets it to Local. Now that you mentioned it, I might have to check if there has been any fix around it.
This is the line where i set it to use Local execution mode: github.com/dyordsabuzo/miscellany/blob/main/tools/terraform-workspace-local.sh#L79 Hopefully that script does not overwhelm you. It's not as simple as I wish it is when I wrote it.
Thank you so much Pablo!!! Best explanation EVERRRRRRRR!!!
Great video. Thank you
This channel is a gem! Thank you!
nicely explained, thanks
well explained.
i have a var.count for no. of cluster. Can I still implement for_each in this case?
If you are creating clusters based on the value of var.count, I think implementing for_each is not necessary since var.count will always force the traversal to be a counter e.q. it will start from 0, then 1, then 2 ...etc. So this will ensure your infrastructure will be idempotent.
But if you are still keen to use for_each, you will have to convert your var.count into a list then convert it to a set:
for_each = toset(range(var.count))
That in itself is already an unnecessary calculation in the code.
nice video, can you do video on dynamic block in creating eks fargate profiles
Why would you use a script to create tf cloud workspaces? Why not just define them in tf... they have a provider with a workspace resource =)
I had issues in the past (not sure if it has been fixed) where terraform sets the execution mode to Remote by default which stops me from running terraform locally. My wrapper script sets it to Local.
Now that you mentioned it, I might have to check if there has been any fix around it.
This is the line where i set it to use Local execution mode: github.com/dyordsabuzo/miscellany/blob/main/tools/terraform-workspace-local.sh#L79
Hopefully that script does not overwhelm you. It's not as simple as I wish it is when I wrote it.
Terraform is now in BSL but unfortunately that PR is still open: github.com/hashicorp/terraform/issues/23261