Terraform Code - Why for_each is better than count

  Рет қаралды 1,202

Pablo's Spot

Pablo's Spot

Күн бұрын

Пікірлер: 12
@darimco3660
@darimco3660 Жыл бұрын
Thank you so much Pablo!!! Best explanation EVERRRRRRRR!!!
@mariuspike
@mariuspike Жыл бұрын
Great video. Thank you
@flesz_
@flesz_ Жыл бұрын
nicely explained, thanks
@gergelytoth8082
@gergelytoth8082 Жыл бұрын
This channel is a gem! Thank you!
@samuelkoramoah3552
@samuelkoramoah3552 Жыл бұрын
well explained.
@ventin75
@ventin75 3 ай бұрын
i have a var.count for no. of cluster. Can I still implement for_each in this case?
@pablosspot
@pablosspot 3 ай бұрын
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.
@2mahender
@2mahender Жыл бұрын
nice video, can you do video on dynamic block in creating eks fargate profiles
@raysmets9162
@raysmets9162 Жыл бұрын
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 =)
@pablosspot
@pablosspot Жыл бұрын
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.
@pablosspot
@pablosspot Жыл бұрын
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.
@pablosspot
@pablosspot Жыл бұрын
Terraform is now in BSL but unfortunately that PR is still open: github.com/hashicorp/terraform/issues/23261
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 45 МЛН
Family Love #funny #sigma
00:16
CRAZY GREAPA
Рет қаралды 52 МЛН
PIZZA or CHICKEN // Left or Right Challenge
00:18
Hungry FAM
Рет қаралды 15 МЛН
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 814 М.
Design Patterns: The Movie
1:23:12
levonog
Рет қаралды 10 М.
Why MOST Developer Portfolios are Worthless
12:50
Travis Media
Рет қаралды 13 М.
Full stack web UI with Blazor in .NET 8 | .NET Conf 2023
55:56
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 320 М.
40 Years Of Software Engineering Experience In 19 Minutes
19:10
Continuous Delivery
Рет қаралды 94 М.
How to integrate docker build process with Terraform
28:36
Pablo's Spot
Рет қаралды 687
Trick-or-Treating in a Rush. Part 2
00:37
Daniel LaBelle
Рет қаралды 45 МЛН