This command allows me to execute terragrunt binary within a docker cintainer correctly:
$ docker run -ti --rm -v $HOME/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/apps -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN alpine/terragrunt:0.13.6 bash
I simply have to cd into the directory where the terragrunt config file can be found, and execute the command:
bash-5.0# cd environments/assembly/us-east-1/sqs/ss-error-generic-encrypted/core/
bash-5.0# terragrunt init -reconfigure;terragrunt plan
(this is happening within the docker container shell)
And it works perfectly. However, I need to create a method of executing this from a script (like a Jenkins job), not interactively. So I tried this:
$ docker run -ti --rm -v $HOME/.aws:/root/.aws -v ${HOME}/.ssh:/root/.ssh -v `pwd`:/apps -w /apps/environments/assembly/us-east-1/sqs/ss-error-generic-encrypted/core -e AWS_ACCESS_KEY_ID -e AWS_SECRET_ACCESS_KEY -e AWS_SESSION_TOKEN alpine/terragrunt:0.13.6 terragrunt init -reconfigure; terragrunt plan
The error I see seems like the -w doesn't work the way I think it works:
[terragrunt] 2022/08/27 11:12:14 Error reading file at path /Users/chewmanfoo/bitbucket.org/aws-terraform-infrastructure/terragrunt.hcl: open /Users/chewmanfoo/bitbucket.org/aws-terraform-infrastructure/terragrunt.hcl: no such file or directory
I thought the -w /apps/environments/assembly/us-east-1/sqs/ss-error-generic-encrypted/core would set the working directory to that path within the container, so that I could execute the binary in the proper place. But it seems to be doing something else.
Can anyone lend your expertise?