broad-zoo-34077
08/17/2023, 5:56 AMwhite-airport-8778
infracost generate config --repo-path=. \
--template-path=infracost.yml.tmpl
2. In CircleCI, does the main branch have the same config file? i.e. in CircleCI it would be doing this:
git clone $CIRCLE_REPOSITORY_URL --branch=$BASE_BRANCH --single-branch /tmp/base
# Breakdown using generated config file from main branch
infracost generate config --repo-path=/tmp/base \
--template-path=/tmp/base/infracost.yml.tmpl \
--out-file=/tmp/base/infracost.yml
infracost breakdown --config-file=/tmp/base/infracost.yml \
--format=json \
--out-file=/tmp/infracost-base.json
# Diff using generated config file from feature branch
infracost generate config --repo-path=${TF_ROOT} \
--template-path=${TF_ROOT}/infracost.yml.tmpl \
--out-file=${TF_ROOT}/infracost.yml
infracost diff --config-file=${TF_ROOT}/infracost.yml \
--format=json \
--compare-to=/tmp/infracost-base.json \
--out-file=/tmp/infracost.json
infracost comment --path=/tmp/infracost.json
wonderful-lizard-93382
08/17/2023, 6:30 AMwhite-airport-8778
wonderful-lizard-93382
08/17/2023, 2:22 PMworking_directory:
key in CircleCI config to run commands from relevant directories (one for BASE and one for FEATURE branches) also making sure “path” parameter in config file in project is set properly (it was “.” like in the example) thats what I think was the root of the issue. Resulting comment looks awesome!