Hey guys. I’m comparing `terraform plan` parsed co...
# general
b
Hey guys. I’m comparing
terraform plan
parsed cost estimate vs. read-through-code type. Although the changes are correctly estimated, there’s a difference in the total cost • terraform plan
Copy code
❯ infracost diff --path plan.json
Detected Terraform plan JSON file at plan.json
  ✔ Extracting only cost-related params from terraform
  ✔ Retrieving cloud prices to calculate costs

Project: aws-terraform/staging/infra/plan.json

~ module.monitoring.aws_instance.main[0]
  +$16.64 ($19.94 → $36.59)

    ~ Instance usage (Linux/UNIX, on-demand, t3.small → t3.medium)
      +$16.64 ($16.64 → $33.29)

Monthly cost change for dext/aws-terraform/staging/infra/plan.json
Amount:  +$16.64 ($1,277 → $1,294)
Percent: +1%
• read through the code
Copy code
❯ infracost diff --path . --compare-to infracost-base.json --terraform-var-file=tfvars/live.tfvars
Evaluating Terraform directory at .
  ✔ Downloading Terraform modules
  ✔ Evaluating Terraform directory
  ✔ Retrieving cloud prices to calculate costs

Project: aws-terraform/staging/infra

~ module.monitoring.aws_instance.main[0]
  +$16.64 ($19.94 → $36.59)

    ~ Instance usage (Linux/UNIX, on-demand, t3.small → t3.medium)
      +$16.64 ($16.64 → $33.29)

Monthly cost change for aws-terraform/staging/infra
Amount:  +$16.64 ($1,241 → $1,258)
Percent: +1%
Any idea why is that?
l
@bulky-jackal-21121 it looks like the HCL parsing method might be missing a resource. If you run
infracost breakdown
with
--show-skipped
for each method then you’ll be able to see the cost per resource and any resources that are skipped and compare them.