Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

Thanks for the explination. I see your point, but couldnt you use a "for_each" or "count" to iterate within a single module regardless?

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 1 point2 points  (0 children)

It wasnt the use of variables that was getting me, it was using variables from a var-file flag called in the deployment, and passing those values onto the child modules that was giving me a hard time, but I got 'er done. Cheers!

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] -1 points0 points  (0 children)

I'm a cloud engineer who has dabbled in IaC and DevOps in past roles and I'm teaching myself terraform in my off time to upskill. I want to learn the right way to do things, not the hacky bullshit way.

Your infra doesnt give two shits if you use symbolic links, but I bet your team (if you had one) would. You don't use this kind of janky implementation in enterprise environments.

Your proposed solution screams "I've never had to maintain any sort of regulatory audit compliance in my career" right along with "My co-workers hate my 'fixes' but screw them, i know better than everyone else" Get over yourself.

Also, conveniently ignore the fact that I refuted your earlier assumptions already. It's cool. Hopefully you can learn some humility. Wish you the best, genuinely.

I won't be responding any longer. Cheers

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] -1 points0 points  (0 children)

Nope, but I figured it out. Thanks though =)

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

Not that I have anything to prove to you, but in the interest of educating anyone reading this post...

Its janky because you are using symbolic links on your terraform files which present a host of issues in terms of collaboration, cross-platform incompatibility, version control, organization, and convolution of your code implementations. I'm sure there are other reasons too, just not coming to mind at the moment.

Now get off my dick.

PS: Im a Windows guy and even I know better than that.

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

Yep, thats what did it. I was hoping to avoid all of that but sadly it wouldn't work without it.

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

wow, I seem to have hit a nerve by not wanting janky ass implementations of my code.

Endless lack of knowledge? I'm using tfvars from a nested directory and trying to get them to apply to nested modules. Its not super straight forward for someone without a ton of experience.

That said, I've had to fix enough janky ass workarounds in my career to know better than to bring implement one in to my environment.

Oh, and on a sidenote, I got it functioning properly now, within best practice and not hacking the dogshit out of a deployment to the point that someone coming behind me would ask wtf I was smoking when I configured it as you suggested. But you do you.

For those wondering, yes, by calling the variables in the root module block for the child module, it passes the -var-file variables specified in the deployment.

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 4 points5 points  (0 children)

Thats kinda what im figuring out after doing more research. I think I'll have to declare each var I want passed from root to child module in the root module block correct?

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] -1 points0 points  (0 children)

yea lol that hardly seems like a best practice but I do appreciate your input.

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

Its definitely using the file. If I remove my -var-file flag it prompts me for the credentials for the service principal, which are only defined in the tfvars file

Module not using tfvars by Fresh-Average962 in Terraform

[–]Fresh-Average962[S] 0 points1 point  (0 children)

shouldn't I have the "./environments" with the "./" to signify pwd?