https://platformengineering.org logo
Title
g

Giulia Guizzardi

11/24/2022, 6:00 PM
...And we are live! Join us on YouTube here:

https://www.youtube.com/watch?v=U_CsR5ibrOI

m

Mariya Skalka

11/24/2022, 6:15 PM
Would be awesome if you could give examples of how one can combine the count argument that depends on resources where Terraform doesn't know the amount yet, because they are also going to be created. An example could be that I want to create an AWS VPC resources and in the same terraform plan/apply also add one route to all created route tables from the VPC resource.
d

Dmitriy Kravets

11/24/2022, 6:21 PM
Could you please share your experience with using terraform_remote_state data source. Is it a good practice to rely on that? Upd: I mean that using that data source a lot in my code. Does it make my terraform code more complex and less reusable? Thank you!
m

Mariya Skalka

11/24/2022, 8:11 PM
@Hila F if can take a look at these questions?
h

Hila F

11/24/2022, 10:13 PM
I promise to go over all the questions tomorrow 🙂
The count question- I’m not sure if I fully understood the need, but if I can’t use count, then I’ll switch to a for_each and loop over a variable that has a map of all needed resources terraform_remote_state*-* We use terraform_remote_state quite a lot. it doesn’t make your code more complex. if you need data from a different state, and a regular data source is not helpful enough, then yeah- you can rely on terraform_remote_state. I would use it in the live side, and not modules, because if the remote state will change in a way that will break the module, it could have a bigger blast radius
a

Andre Marcelo-Tanner

11/27/2022, 7:31 PM
We use remote state a lot to read values from other terraform resources. Eg VPC info. Keeping it all updated and connected is harder
z

Ziad Ghalleb

12/01/2022, 8:59 AM
This was a great session! Thanks for using Tiexin's post as a reference, Hila! For everyone else, you can find it here 😄 https://blog.gitguardian.com/9-extraordinary-terraform-best-practices
s

Soren Martius

12/01/2022, 5:20 PM
We use remote state a lot to read values from other terraform resources. Eg VPC info. Keeping it all updated and connected is harder
I second that - remote state lookup is the way to go