red-photographer-82456
01/22/2025, 6:15 AMlively-action-57175
01/24/2025, 12:12 PMbright-wire-821
01/27/2025, 10:01 AMred-photographer-82456
01/29/2025, 10:07 AMcool-ocean-61678
01/29/2025, 5:40 PMworried-dinner-15254
01/30/2025, 10:26 PMdamp-vase-72566
01/31/2025, 4:10 PMinfracost breakdown --path=. --usage-file=../infracost-usage.yml --show-skipped
i get a table of costs with usage, all good. When i output as json and then publish to an ADO PR using `infracost comment`the baseline costs are not uploaded to the PR. Now i know this is not quite the norm - i understand that a PR should be showing the differences between the main branch and the PR branch, but when there are no changes to terraform in a PR, id like to show the baseline costs of the master branch, rather than no costs from the diff. Does that make sense? Is it possible? I am using the cli via cicd, at present there are no plans to move to the infracost cloud offering.
Note - when i publish a PR with actual TF changes, it shows the usage, so i know my call to `infracost comment`does work.red-photographer-82456
02/03/2025, 11:38 AMquaint-analyst-14410
02/05/2025, 11:34 AMdamp-vase-72566
02/05/2025, 4:09 PM--sync-usage-file
flag when running a breakdown
infracost breakdown --config-file ./infracost/infra-cost.yml --sync-usage-file --out-file=./infracost-breakdown --format=table --no-color path=terraform
The output shows Synced 0 of 89 resources
for each of the projects. Can anyone shed any light? I am authenticated to AWS (that shows a different error if not authenticated). Even though 0 resources are synced i am seeing that the infracost-usage.yml file gets updated to reflect the resources in the project so it appears to be working in some form. EDIT This is either no longer the case or i was misreading the content. When i use the --sync-usage-file
parameter my entire infracost-uage.yml is commented out.
More meat to the bones. I forgot to declare that i am using terragrunt and am running the breakdown from the root terraform folder (not a plan). The infracost-usage.yml output, whilst commented out with values of 0, it is recognising my resources, for example:
# aws_ssm_parameter.alternate_queue_names["ARedactedQueueName"]:
# api_throughput_limit: standard # SSM Parameter Throughput limit, can be: standard, advanced, higher.
# monthly_api_interactions: 0 # Monthly API interactions.
# parameter_storage_hrs: 0 # Number of hours in the month parameters will be stored for.
I have also generated an infracost.yml config file which describes the terragrunt folder structure for example:
version: 0.1
projects:
- path: environments/test
name: test
usage_file: environments/test/infracost-usage.yml
- path: environments/prod
name: prod
usage_file: environments/prod/infracost-usage.yml
I am going to interrogate the debug logs to see if there is anything of interest in thereworried-intern-40629
02/11/2025, 2:01 PMdamp-vase-72566
02/13/2025, 9:49 AMicy-night-43046
02/19/2025, 12:00 PMbulky-boots-10226
02/21/2025, 1:46 PMinfracost comment bitbucket --exclude-cli-output --path "/atlantis/tmp/$PULL_NUM/cost.json.*" --repo $BASE_REPO_OWNER/$BASE_REPO_NAME --pull-request $PULL_NUM --bitbucket-token user/pass --behavior update
I get the error in this screenshotthousands-arm-53034
03/04/2025, 9:58 PMechoing-father-81832
03/10/2025, 2:28 PMbrash-translator-79007
03/20/2025, 5:03 PMinfracost/infracost:ci-latest
infracost --version
Infracost v0.10.41
When running breakdown
I get:
WARN 1 aws_instance price missing across 1 resource
This happens for:
instance_type = "g5.12xlarge"
gorgeous-island-10432
03/20/2025, 5:45 PMgorgeous-island-10432
03/21/2025, 2:17 PMgorgeous-island-10432
03/21/2025, 2:17 PMbillions-pencil-2654
04/03/2025, 2:30 PMrich-journalist-85976
04/07/2025, 10:37 AMgreen-france-56695
04/08/2025, 9:55 AM1 error occurred:
* error fetching module git::<ssh://git@github.com/jupitermoney/terraform-root-modules.git?ref=develop> from remote: error downloading '<ssh://git@github.com/jupitermoney/terraform-root-modules.git?ref=develop>': /usr/bin/git exited with 128: Cloning into '/usr/src/app/jupitermoney/dev.jupiter.money/infracost-test/.infracost/.terragrunt-cache/36S544WW_7cwW6wKd1x23Est88A'...
Warning: Permanently added '<http://github.com|github.com>' (ED25519) to the list of known hosts.
<mailto:git@github.com|git@github.com>: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Is it possible to connect and close this setup? Thanks in advanceworried-dinner-15254
04/29/2025, 12:30 AMripe-motherboard-63211
04/29/2025, 8:11 AMwitty-beard-49162
05/14/2025, 9:24 AMError loading Terraform modules: could not load modules for path . failed to parse file .infracost/terraform_modules/4be729b152ff5fe757b510249ccab486/main.tf diag: .infracost/terraform_modules/4be729b152ff5fe757b510249ccab486/main.tf:3,56-57: Missing argument separator; A comma is required to separate each function argument from the next.
My CI/CD job looks like this :
infracost:merge-request-checks:
tags:
- docker-M
stage: infracost:merge-request-checks
image:
# Always use the latest 0.10.x version to pick up bug fixes and new resources.
# See <https://www.infracost.io/docs/integrations/cicd/#docker-images> for other options
name: infracost/infracost:ci-0.10
entrypoint: [""]
script:
# If you use private modules, add an environment variable or secret
# called GIT_SSH_KEY with your private key, so Infracost can access
# private repositories (similar to how Terraform/Terragrunt does).
- mkdir -p ~/.ssh
`- eval `ssh-agent -s``
- echo "$GIT_SSH_KEY" | tr -d '\r' | ssh-add -
# Update this to <http://github.com|github.com>, <http://gitlab.com|gitlab.com>, <http://bitbucket.org|bitbucket.org>, <http://ssh.dev.azure.com|ssh.dev.azure.com> or your source control server's domain
- ssh-keyscan <http://gitlab.kazan.myworldline.com|gitlab.kazan.myworldline.com> >> ~/.ssh/known_hosts
# Clone the base branch of the pull request (e.g. main/master) into a temp directory.
- git clone $CI_REPOSITORY_URL --branch=$CI_MERGE_REQUEST_TARGET_BRANCH_NAME --single-branch /tmp/base
# Generate an Infracost cost snapshot from the comparison branch, so that Infracost can compare the cost difference.
- infracost breakdown --path=/tmp/base/${TF_ROOT} --format=json --out-file=infracost-base.json
# Generate an Infracost diff and save it to a JSON file.
- infracost diff --path=${TF_ROOT} --compare-to=infracost-base.json --format=json --out-file=infracost.json
- infracost comment gitlab --path=infracost.json --repo=$CI_PROJECT_PATH --merge-request=$CI_MERGE_REQUEST_IID --gitlab-server-url=$CI_SERVER_URL --gitlab-token=$GITLAB_TOKEN --behavior=update
variables:
INFRACOST_API_KEY: $INFRACOST_API_KEY
`GITLAB_TOKEN: $GITLAB_TOKEN # With api
scope and Maintainer role to post merge request comments`
rules:
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
artifacts:
paths:
- infracost.json
- infracost-base.json
expire_in: 1 days
My repository tree is simple as every tf file are in root (.)
Modules they used are in our private gitlab host (which is why i also tried with the ssh commands activated, exact same result)
Also the infracost commands are working perfectly locally
Let me know if more infos are needed for analysis =)limited-intern-19479
05/22/2025, 5:12 PMHEAD
and main
on a PR).
- name: "Generate Infracost cost estimate baseline" # Generate base branch cost.
run: >
infracost breakdown
--config-file .infracost.yml
--format json
--out-file /tmp/infracost-base.json
This errors out, saying that --path
is required. Is the --config-file
argument not supported in Actions?limited-intern-19479
05/22/2025, 6:39 PMrun: >
does not.little-apple-76419
05/27/2025, 10:34 AMon_demand
instance though
Example Query:
query {
products(
filter: {
vendorName: "aws"
service: "AmazonEC2"
productFamily: "Compute Instance"
region: "us-east-1"
attributeFilters: [
{ key: "instanceType", value: "i7i.2xlarge" }
{ key: "operatingSystem", value: "Linux" }
{ key: "licenseModel", value: "No License required" }
{ key: "tenancy", value: "Shared" }
{ key: "capacitystatus", value: "Used" }
{ key: "preInstalledSw", value: "NA" }
]
}
) {
prices(filter: { purchaseOption: "spot" }) {
USD
}
}
}
what is the reason for this?gifted-fireman-79125
06/04/2025, 10:10 AM