You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey community,
I'm looking for best practices on how to exclude specific resources from a shared Terraform module in a clean and maintainable way.
Use case:
In our setup, data scientists use a workbench that's defined in a shared Terraform module. However, certain resources differ between dev and prod environments. I want to exclude specific resources (e.g., an aws_s3_bucket) from being created in some environments.
I’m aware of the count workaround, like this:
However, I find this approach somewhat clunky, especially when using Terragrunt to keep the code DRY. The need to pass or default the variable in multiple places seems to go against that principle.
Question:
Is there a more Terragrunt-native way to handle conditional resource inclusion that avoids having to sprinkle logic or variables across all environments?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hey community,
I'm looking for best practices on how to exclude specific resources from a shared Terraform module in a clean and maintainable way.
Use case:
In our setup, data scientists use a workbench that's defined in a shared Terraform module. However, certain resources differ between dev and prod environments. I want to exclude specific resources (e.g., an aws_s3_bucket) from being created in some environments.
I’m aware of the count workaround, like this:
However, I find this approach somewhat clunky, especially when using Terragrunt to keep the code DRY. The need to pass or default the variable in multiple places seems to go against that principle.
Question:
Is there a more Terragrunt-native way to handle conditional resource inclusion that avoids having to sprinkle logic or variables across all environments?
Appreciate any tips or shared experiences!
Beta Was this translation helpful? Give feedback.
All reactions