Open gtmtech opened 1 year ago
Hi. Would also love to have this, as otherwise it's not possible to have truly dynamic infrastructures, as dependencies end up being static, without resorting to some techniques like aggregating elements in a source module with multiple elements so it's only 1 dependency. Maybe this is difficult due to the impact on graph generation, but would be very useful nevertheless.
Hi I would also love to have this.
My use case is this: I am testing different architectures and want to export ssm vars based on the fact that some env variable is set.
If USE_ALB is set want to create and export load balancer vars, otherwise do something else.
terraform {
source = "github.com/kristijorgji/terraform-aws-ssm-store?ref=v1.1.0"
}
// TODO include dynamically only if tobool(get_env("TG_USE_ALB", "false")) === true
dependency "alb" {
config_path = "../alb/instance"
}
inputs = {
kms_alias = "alias/aws/ssm"
name_prefix = "/test"
overwrite = true
parameters = concat(
[
{
name = "dafsasdffds"
value = "dada"
type = "SecureString"
overwrite = true
},
],
tobool(get_env("TG_USE_ALB", "false")) ? [
{
name = "lb_https_listener_arn"
value = element(dependency.alb.outputs.https_listener_arns, 0)
}, ] : []
)
}
Describe the solution you'd like
I am fetching my dependencies from external commands for reasons.
This works with
dependencies
block as I can inject into the paths attribute:But I cannot do this for
dependency
block, becausedependency
is a block. I note from https://github.com/gruntwork-io/terragrunt/issues/1571 that it is said that it is not currently supported to generate dependency dynamically.I would like this ability natively supported
Describe alternatives you've considered
Searching for ways to achieve this. I thought of a hacky way to do it as follows:
Would work, but not exactly friendly or DRY
Additional context