gruntwork-io/terragrunt-infrastructure-live-example

Input dependency value with if statement

Opened this issue · 0 comments

I checked documentation but cannot find answer.

Is it possible to pass conditional dependency?

dependency "eks" {
  config_path = "${dirname(find_in_parent_folders("env.hcl"))}/eks"

  mock_outputs = {
    cluster_arn  = "temporary-cluster-arn"
    cluster_id   = "temporary-cluster-id"
    cluster_name = "temporary-cluster-name"
  }
}

inputs = {
  cluster_name   = "${dependency.eks.outputs.cluster_name}" == "temporary-cluster-name" : "${dependency.eks.outputs.cluster_id}" ? "${dependency.eks.outputs.cluster_name}"
}

Getting Error:

Missing attribute separator; Expected a newline or comma to mark the beginning of the next attribute.
ERRO[0000] Unable to determine underlying exit code, so Terragrunt will exit with error code 1

The idea is to pass cluster_id if cluster_name is not returned.
There is a new version of module where cluster_id is replaced with cluster_name.
I have multiple env. running and cannot change yet all in one go. Looking for solution.