boundless-london-92014
09/21/2022, 9:22 AMError: config file does not exist at terraform/infracost_config.yml
this error does not appear with only the multi-project config file configured, but does once i try to add the caching steps to it. any clue what i'm doing wrong?busy-agent-35515
09/21/2022, 9:41 AMboundless-london-92014
09/21/2022, 10:27 AMThe purpose of this workflow is to run Terragrunt Plan for all affected components in a PR
name: Terragrunt-price
on:
pull_request:
branches:
- main
env:
TF_IN_AUTOMATION: true
TF_PLUGIN_CACHE_DIR: "/home/runner/cache/terragrunt"
TERRAGRUNT_ASSUME_ROLE: true
jobs:
terragrunt-prepare-plans:
name: Prepare terragrunt-plans
runs-on: [ self-hosted, stable ]
steps:
- name: Plan - Add scripts to PATH
run: echo "${GITHUB_WORKSPACE}/.github/workflows/scripts/" >> $GITHUB_PATH
- name: Plan - Checkout code
uses: actions/checkout@v2.0.0
with:
clean: true
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Plan - Setup terra runner
run: setup-terra-runner.sh
- name: Setup Infracost
uses: infracost/actions/setup@v2.0.0
with:
api-key: ${{ secrets.INFRACOST_API_KEY }}
currency: EUR
- name: Cache the Infracost baseline JSON result
id: cache-infracost-base-json
uses: actions/cache@v3
with:
path: '/tmp/infracost-base.json'
key: infracost-base-json-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.sha }}
# Checkout the base branch of the pull request (e.g. main/master).
- name: Checkout base branch
uses: actions/checkout@v2
with:
ref: '${{ github.event.pull_request.base.ref }}'
# Downloading remote Terraform modules can be slow, so we add them to the GitHub cache.
# We skip this for pushes to the main/master branch that already have the baseline generated.
- name: Cache .infracost/terraform_modules for target branch
uses: actions/cache@v3
with:
path: terraform/**/.infracost/terraform_modules/**
!terraform/**/.infracost/terraform_modules/**/.git/**
key: infracost-terraform-modules-${{ runner.os }}-${{ github.event.pull_request.base.sha || github.sha }}
# If there's no cached record for this commit, pull in the latest cached record anyway
# Internally infracost will downloaded any additional required modules if required
restore-keys: infracost-terraform-modules-${{ runner.os }}-
if: github.event_name == 'pull_request' || steps.cache-infracost-base-json.outputs.cache-hit != 'true'
- name: Run Infracost
run: infracost breakdown --config-file=terraform/infracost_config.yml --format=json --out-file=/tmp/infracost-base.json
if: steps.cache-infracost-base-json.outputs.cache-hit != 'true'
# Checkout the current PR branch so we can create a diff.
- name: Checkout PR branch
uses: actions/checkout@v2
with:
# Make sure the .infracost dir stays between runs so that downloaded modules persist
clean: false
if: github.event_name == 'pull_request'
# Generate an Infracost diff and save it to a JSON file.
- name: Generate Infracost diff
run: infracost diff --config-file=terraform/infracost_config.yml --format=json --compare-to=/tmp/infracost-base.json --out-file=/tmp/infracost.json
if: github.event_name == 'pull_request'
# Posts a comment to the PR using the 'update' behavior.
# This creates a single comment and updates it. The "quietest" option.
# The other valid behaviors are:
# delete-and-new - Delete previous comments and create a new one.
# hide-and-new - Minimize previous comments and create a new one.
# new - Create a new cost estimate comment on every push.
# See <https://www.infracost.io/docs/features/cli_commands/#comment-on-pull-requests> for other options.
- name: Post Infracost comment
run: infracost comment github --path=/tmp/infracost.json --repo=$GITHUB_REPOSITORY --github-token=${{github.token}} --pull-request=${{github.event.pull_request.number}} --behavior=update
if: github.event_name == 'pull_request'
busy-agent-35515
09/21/2022, 11:22 AMecho $(pwd)
and echo $(ls)
or echo $(ls terraform/)
to see what's going on. Maybe it can give a clueinfracost breakdown
or infracost diff
boundless-london-92014
09/21/2022, 12:31 PMbusy-agent-35515
09/21/2022, 12:36 PMboundless-london-92014
09/21/2022, 12:39 PM