Live data from Hacker News

Terraform Config Root Setups

resourcely.io

51–53 of 53 posts

Re: Terraform Config Root Setups

#51

Earlier quoted context omitted.

I just wanted to clarify: are you referring to this pattern? module "cool_name" { count = var.create_cool_name ? 1 : 0 } I've always wanted a simple enable/disable syntax for modules in tf.

> I just wanted to clarify: are you referring to this pattern? Does TF support count on modules now?! The pattern I was referring to is akin to having an `enabled` var that you define in _every_ module (there are ways to make this easier to do [0]) and inside of each module you have a local { make_the_s3_bucket = var.enabled && var.make_s3_bucket make_the_rds_instance = var.enabled && var.enable_rds } Then you use th…

Yeah I use the count attribute on modules all the time.

Thank you for replying though, I appreciate it :)

Re: Terraform Config Root Setups

#52

Earlier quoted context omitted.

I just wanted to clarify: are you referring to this pattern? module "cool_name" { count = var.create_cool_name ? 1 : 0 } I've always wanted a simple enable/disable syntax for modules in tf.

> I just wanted to clarify: are you referring to this pattern? Does TF support count on modules now?! The pattern I was referring to is akin to having an `enabled` var that you define in _every_ module (there are ways to make this easier to do [0]) and inside of each module you have a local { make_the_s3_bucket = var.enabled && var.make_s3_bucket make_the_rds_instance = var.enabled && var.enable_rds } Then you use th…

https://developer.hashicorp.com/terraform/language/modules/s...

count - Creates multiple instances of a module from a single module block.

for_each - Creates multiple instances of a module from a single module block.

providers - Passes provider configurations to a child module. If not specified, the child module inherits all of the default (un-aliased) provider configurations from the calling module.

depends_on - Creates explicit dependencies between the entire module and the listed targets.

I hope this doesn't come across as snarky, I just wanted to share the doc link :)

Re: Terraform Config Root Setups

#53

Terragrunt goes a long way to providing a near-perfect way to structure Terraform repos.

I didn't understand the benefit of using terragrunt. Modern terraform supports all of the features terragrunt was originally designed to work around way back when. Outside of being able to use variables in very niche places that you can't in terraform (and can easily work around, and that last I heard is on the road map for open tofu), what does terragrunt do that using regular module imports in terraform don't? This…

I'm from Gruntwork; we're the maintainers of Terragrunt.

We get this question a lot because Terragrunt did in fact start as a feature shim for Terraform. But that was a long time ago and Terragrunt has evolved into a first-class "orchestration" tool for Terraform or OpenTofu.

We wrote a blog post addressing exactly your concern that you might find helpful: https://blog.gruntwork.io/terragrunt-opentofu-better-togethe....

Post reply on HN