antonbabenko / terragrunt-reference-architecture

Terragrunt Reference Architecture (upd: May 2020)
MIT License
375 stars 104 forks source link

The terragrunt function wrapper is not compatible with the later versions of Terragrunt #9

Closed james-gonzalez closed 2 years ago

james-gonzalez commented 2 years ago
terragrunt () {
    local action=$1
    shift 1
    command terragrunt $action "$@" 2>&1 | sed -E "s|$(dirname $(pwd))/||g;s|^\[terragrunt\]( [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2})* ||g;s|(\[.*\]) [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}|\1|g"
}

The problem is that with any command which requires input, it never comes up.

Example:

terragrunt run-all apply
time=2021-12-04T14:55:46Z level=info msg=The stack at uat will be processed in the following order for command apply:
Group 1
- Module uat/network

Group 2
- Module uat/ecs_service

I'm not actually sure what the fix would be... but basically, it's now showing Are you sure you want to run 'terragrunt apply' in each folder of the stack described above? (y/n) until you actually enter y or n

antonbabenko commented 2 years ago

Yes, you are right that this function does not work in interactive mode.

With the later versions of Terragrunt, I updated it to be:

terragrunt () {
        local action=$1 
        shift 1
        command terragrunt $action --terragrunt-log-level error "$@"
}

Feel free to submit a PR if you want to improve it :)