costory-io/costory) calls the Costory API from your Terraform configuration. You can create billing datasources, publish enrichments, and manage teams and their members, then review every change in a pull request before terraform apply. The source is on GitHub.
Install the provider
Declare the provider in your configuration, then runterraform init.
Authenticate
Create an API token
Pass the token to the provider
terraform.tfvars or as TF_VAR_costory_api_token.Look up the Costory service account
Thecostory_service_account data source returns the Costory service account name (service_account) and subscription IDs (sub_ids). The AWS and Google Cloud examples use it to grant Costory read access to your billing exports.
Billing datasources
Each billing datasource is one resource. Costory validates the connection when you apply, so a wrong credential or missing permission fails before any sync starts.terraform destroy deletes the datasource and permanently deletes the data it ingested. See Billing data for history and refresh details.
The examples below assume the provider block above. Secrets are passed as sensitive variables.
Aiven: costory_billing_datasource_aiven
Aiven: costory_billing_datasource_aiven
Anthropic Console (API usage): costory_billing_datasource_anthropic
Anthropic Console (API usage): costory_billing_datasource_anthropic
Anthropic claude.ai: costory_billing_datasource_anthropic_claude_ai
Anthropic claude.ai: costory_billing_datasource_anthropic_claude_ai
AWS (CUR 2.0): costory_billing_datasource_aws
AWS (CUR 2.0): costory_billing_datasource_aws
Azure Cost Management: costory_billing_datasource_azure
Azure Cost Management: costory_billing_datasource_azure
ClickHouse Cloud: costory_billing_datasource_clickhouse_cloud
ClickHouse Cloud: costory_billing_datasource_clickhouse_cloud
Cloudflare: costory_billing_datasource_cloudflare
Cloudflare: costory_billing_datasource_cloudflare
Confluent Cloud: costory_billing_datasource_confluent
Confluent Cloud: costory_billing_datasource_confluent
Cursor: costory_billing_datasource_cursor
Cursor: costory_billing_datasource_cursor
Custom billing table in BigQuery: costory_billing_datasource_custom_bigquery
Custom billing table in BigQuery: costory_billing_datasource_custom_bigquery
billed_cost is required. Full schema: Registry.Datadog: costory_billing_datasource_datadog
Datadog: costory_billing_datasource_datadog
Elastic Cloud: costory_billing_datasource_elastic_cloud
Elastic Cloud: costory_billing_datasource_elastic_cloud
Google Cloud (BigQuery billing export): costory_billing_datasource_gcp
Google Cloud (BigQuery billing export): costory_billing_datasource_gcp
Google Cloud CUD export: costory_billing_datasource_gcp_cud_export
Google Cloud CUD export: costory_billing_datasource_gcp_cud_export
OpenAI: costory_billing_datasource_openai
OpenAI: costory_billing_datasource_openai
Scaleway: costory_billing_datasource_scaleway
Scaleway: costory_billing_datasource_scaleway
Snowflake: costory_billing_datasource_snowflake
Snowflake: costory_billing_datasource_snowflake
Enrichments
costory_enrichment stores one YAML lookup file as a draft. costory_enrichments_publish publishes every draft in one transaction after the files are written, and removes the enrichments whose file you deleted. See Publish with Terraform for the file format.
Teams and members
costory_team creates a PUBLIC or PRIVATE team. costory_team_member adds a member by email or user_id, with the OWNER or MEMBER role. Team scopes are still managed in the UI. See Teams.
