- Add the terraform configuration to your terraform code
- Add all files main.tf, variables.tf, output.tf, terraform.tfvars
mac/linux
# Downloads the CLI based on your OS/arch and puts it in /usr/local/bin
curl -fsSL https://raw.githubusercontent.com/infracost/infracost/master/scripts/install.sh | sh
infracost --version # Should show 0.10.31
Windows (Run in powershell with admin mode)
choco install infracost
infracost --version # Should show 0.10.31
infracost auth login
infracost configure get api_key
infracost breakdown --path .
Generate an Infracost JSON file as the baseline:
infracost breakdown --path . --format json --out-file infracost-base.json
# try changing the instance type:
vim main.tf
# Generate a diff by comparing the latest code change with the baseline:
infracost diff --path . --compare-to infracost-base.json
infracost upload --path infracost-base.json
Add to the VS-code extension