Skip to content

run_cmd is always executed - ternary operator is not correctly supported #1448

@ahmad-hamade

Description

@ahmad-hamade

I need to run a conditional run_cmd based on the below:

locals {
  condition = true
  value     = local.condition ? run_cmd("echo", "A") : run_cmd("echo", "B")
}

Running terragrunt plan/apply will execute always both commands:

[terragrunt] 2020/11/29 14:45:23 Running command: echo A
A
[terragrunt] 2020/11/29 14:45:23 run_cmd output: [A
]
[terragrunt] 2020/11/29 14:45:23 Running command: echo B
B
[terragrunt] 2020/11/29 14:45:23 run_cmd output: [B
]

The expected behavior is to run only run_cmd("echo", "A")

I'm using terragrunt version v0.26.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcontributions-requestedRequesting contributions from the communityenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions