Cost estimation
Terrateam can automatically provide cost estimates on each pull request that Terrateam runs a plan operation against. A comment will be placed alongside plan output showing the monthly spend change for the dirspace.
Configuration
Cost estimation is configured in the .terrateam/config.yml
file under the cost_estimation
key. Here’s the default configuration:
Enabled
The enabled
key is used to specify whether cost estimation is enabled or not.
Key | Type | Description |
---|---|---|
enabled | Boolean | Specifies whether cost estimation is enabled. Default is true . |
Provider
The provider
key is used to specify the cost estimation provider.
Key | Type | Description |
---|---|---|
provider | String | Cost estimation provider. Default is infracost . |
Currency
The currency
key is used to specify the currency in which cost estimates are reported.
Key | Type | Description |
---|---|---|
currency | String | An ISO 4217 currency code to report results. Default is USD . |
Providers
Infracost
API key
If an Infracost API key is configured as a GitHub Actions Secret, then Terrateam will use the official Infracost public API endpoint. To set your Infracost API Key as a GitHub Actions Secret:
- Export your Terraform
organization/repo
combination as an environment variable. For example:
- Create the Infracost API Key GitHub Secret:
Environment variables
Terrateam supports the following Infracost environment variables:
Name | Description |
---|---|
INFRACOST_API_KEY | User’s Infracost API key. Sign up and navigate to the Org Settings page to get your free Infracost API key. |
INFRACOST_CURRENCY | An ISO 4217 currency code to report results. The value in the repository configuration takes precedence. |
Examples
Enable cost estimation with default settings
This configuration will enable cost estimation using the default provider (Infracost) and currency (USD).
Disable cost estimation
This configuration will disable cost estimation.
Specify a different currency
This configuration will enable cost estimation and report results in Euros (EUR).