broad-zoo-34077
06/11/2021, 9:55 AMgray-school-17920
06/11/2021, 9:56 AMRunning infracost breakdown using:
$ infracost breakdown --no-color --format json --path /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/default.tfplan
time="2021-06-10T13:22:12Z" level=info msg="Detected Terraform plan file at /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/default.tfplan"
time="2021-06-10T13:22:12Z" level=warning msg="Can't sync usage file as it's not specified"
time="2021-06-10T13:22:12Z" level=debug msg="Checking if /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/default.tfplan is a git repo"
time="2021-06-10T13:22:12Z" level=debug msg="Could not detect Terraform workspace for /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/default.tfplan"
Error: Terraform binary "/usr/local/bin/terragrunt --terragrunt-tfpath /atlantis-data/bin/terraform1.0.0" could not be found.
Set a custom Terraform binary in your Infracost config or using the environment variable INFRACOST_TERRAFORM_BINARY.
[terragrunt] [/atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis] 2021/06/10 13:20:55 Running command: terraform1.0.0 --version
[terragrunt] 2021/06/10 13:20:56 Terraform version: 1.0.0
[terragrunt] 2021/06/10 13:20:56 Reading Terragrunt config file at /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/terragrunt.hcl
[terragrunt] 2021/06/10 13:20:56 Generated file /atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis/backend.tf.
[terragrunt] [/atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis] 2021/06/10 13:20:56 Initializing remote state for the s3 backend
[terragrunt] [/atlantis-data/repos/productboard/pb-infrastructure/464/default/aws/pb-ops-843222783279/us-east-1/elasticache-redis] 2021/06/10 13:20:57 Running command: terraform1.0.0 init
Initializing modules...
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
gray-school-17920
06/11/2021, 9:58 AMworkflows:
terragrunt:
plan:
steps:
- env:
name: INFRACOST_LOG_LEVEL
value: debug
- env:
name: atlantis_debug
value: true
- env:
name: TERRAGRUNT_TFPATH
command: 'echo "terraform${ATLANTIS_TERRAFORM_VERSION}"'
- env:
name: TF_CLI_ARGS
value: "-no-color"
- init:
# <https://github.com/runatlantis/atlantis/issues/1408>
extra_args: ["-upgrade=false"]
- run: terragrunt plan -out $PLANFILE
- env:
name: INFRACOST_TERRAFORM_BINARY
command: 'echo "/usr/local/bin/terragrunt --terragrunt-tfpath /atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION}"'
- run: "/home/atlantis/infracost_atlantis_diff.sh"
little-author-61621
"/usr/local/bin/terragrunt --terragrunt-tfpath /atlantis-data/bin/terraform1.0.0"
. I'm guessing it's the flag that's causing the issue.
I wonder if this can be solved by setting INFRACOST_TERRAFORM_BINARY=/usr/local/bin/terragrunt
and also passing in a separate env var for TERRAGRUNT_TFPATH=/atlantis-data/bin/terraform1.0.0
white-airport-8778
INFRACOST_TERRAFORM_BINARY
here? since there is a $PLANFILE already, infracost would run terraform show
and that switches plan binary to json, right?little-author-61621
gray-school-17920
06/11/2021, 11:37 AM- env:
name: INFRACOST_TERRAFORM_BINARY
command: 'echo "/atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION}"'
Removing INFRACOST_TERRAFORM_BINARY didn’t work for me because it looks like we have terraform 0.15.1 at /usr/loca/bin/terraform so it tried to read the planfile with a different TF version
Thanks for the quick help!little-author-61621
white-airport-8778
/usr/local/bin/terraform0.12.30
.
• a relative path from the directory in which Atlantis keeps the Terraform binary in, e.g. <data-dir>/bin/terraform<version>
. Terragrunt users should use this, e.g. 'echo "/atlantis-data/bin/terraform${ATLANTIS_TERRAFORM_VERSION}"'
Any other suggestion on how to improve the readme?gray-school-17920
06/16/2021, 11:39 AMterragrunt
binary be used for Infracost.
In my case, it’s enough to set _`INFRACOST_TERRAFORM_BINARY`_ to the TF binary directly, since terragrunt outputs the Planfile in our workflow. The terragrunt specific docs don’t really help in that regard.white-airport-8778
INFRACOST_TERRAFORM_BINARY
altogether. Feel free to watch that ticket or comment if you have ideas/use-cases.