Using For_Each in a Terraform Module with Azure VNets and Bastion Host
Ғылым және технология
Yet another in a series on Terraform and Azure. This one goes into detail on using loops in a Terraform Module. We deploy an Azure VNet and Bastion host with a module, looping through a variable number of subnets with a for_each statement. Then, we output the subnet IDs and public IP of the Bastion host.
00:00 - Start
03:30 - Create the Module
05:19 - Create a For_Each Loop
09:56 - Referencing a For_Each Instance
13:49 - Apply the Configuration
Links
Zero to Hero with Azure Virtual Desktop
www.udemy.com/course/zero-to-...
Hybrid Identity with Windows AD and Azure AD
www.udemy.com/course/hybrid-i...
Terraform Playlist
• Getting Started with T...
Code on Github
github.com/tsrob50/TerraformE...
Blog
www.ciraltos.com/use-for_each...
Пікірлер: 20
I really appreciate this playlist. I've watched many videos on how to learn Terraform and your examples and explanations have worked wonders for me in understanding the material and able to retain and work on it on my own.
I loved this playlist
Really enjoying these terraform tutorials Travis. Hope you will continue doing these!
@Ciraltos
2 жыл бұрын
Thanks! I have a few more to come.
Many thanks Travis for the video. you explain simply. perfect for those who are new to Terraform. I really enjoyed watching it and learning Terraform.
@Ciraltos
2 жыл бұрын
Glad it was helpful!
Your Videos are amazing, there were a couple of things I have struggled to get my head around with Terraform over the four years of using it and that was Modules and For Each. Your Video literally made light bulb moments go off. I was like oh that's how that is done, as I could never work it our from the documentation and I'm Terraform Certified too I wish I came across you earlier as time to prep for the exam would have shot down.
Agree the amount of times I've spent trying to fix an issue. I step away for an hour and fix it within 5 minutes 😅
Thanks a ton Travis this really helped this was something which was bothering me yesterday whole day
Sir, You are really my god!!
@Ciraltos
2 жыл бұрын
Happy to help
You the man. Enjoying all your terraform videos. Where do you get all your awesome shirts from? terraform fmt command is great help to fix indentation/formatting.
Great Content !!!
@Ciraltos
2 жыл бұрын
Appreciate it!
Hi Travis, I learned Terraform quickly because of your videos. Could you make a video about 2 VMS with different detail and their nic, and how to connect it to vnet and bastion host.
Thank you!
Great content, but here you are using predefined subnet variable. What if we are creating subnet by using terraform, and the only thing known will be the count of subnets and instances. Using for_each in that case gives error: How to solve this? "The "for_each" map includes keys derived from resource attributes that cannot be determined until apply, and so Terraform cannot │ determine the full set of keys that will identify the instances of this resource."
how to pick up 1 value on the for_each loop instead picking up all the values?
@Travis Roberts can you make a video on child modules to create multiple resources with loop
Hi Travis, can I trouble you with a query around for_each loop? Pls let me know a place to draft an e-mail about it.