Skip to content

doitintl/terraform-provider-doit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

198 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DoiT Cloud Intelligence Provider

Tests Release Terraform Registry Go License

The DoiT Cloud Intelligence Terraform Provider lets you manage DoiT Cloud Intelligence resources as code using the DoiT API. It covers FinOps workflows (budgets, allocations, alerts, reports), operational data (anomalies, incidents, commitments, assets), and organizational resources (labels, annotations, DataHub datasets).

Important

Upgrading from v0.x? Version 1.0.0 contains breaking changes. See the v1.0.0 Upgrade Guide for migration instructions.

Getting Started

Prerequisites

Authentication

The provider supports three configuration options, all of which can be set via environment variables:

Attribute Environment Variable Required Description
api_token DOIT_API_TOKEN Yes Your DoiT API key
host DOIT_HOST No API host (defaults to https://api.doit.com)
customer_context DOIT_CUSTOMER_CONTEXT No* Customer context (required for DoiT employees only)

Provider Configuration

terraform {
  required_providers {
    doit = {
      source  = "doitintl/doit"
      version = "~> 1.0"
    }
  }
}

provider "doit" {
  # Set DOIT_API_TOKEN in your environment before running terraform apply
}

Or configure explicitly:

provider "doit" {
  api_token        = "your-api-key"
  customer_context = "your-customer-context" # DoiT employees only
}

Available Resources

Resources

Resource Description
doit_alert Cost/usage alerts with threshold notifications
doit_allocation Cost allocation rules and groups
doit_annotation Custom notes on cost data
doit_asset Cloud assets (import-only; manage Google Workspace licenses)
doit_budget Budget tracking with alerts and seasonal amounts
doit_datahub_dataset DataHub dataset management
doit_label Labels for categorizing annotations
doit_label_assignments Assign labels to resources
doit_report Cloud Analytics reports with filters, metrics, and grouping
doit_sharing Sharing permissions for reports, budgets, alerts, and allocations

Data Sources

FinOps — budgets, allocations, alerts, reports
Data Source Description
doit_alert / doit_alerts Get or list cost/usage alerts
doit_allocation / doit_allocations Get or list allocation rules
doit_budget / doit_budgets Get or list budgets
doit_report / doit_reports Get or list Cloud Analytics reports
doit_report_query Run ad-hoc Cloud Analytics queries
doit_report_result Get results from an existing report
doit_dimensions List available report dimensions
Operations — anomalies, incidents, commitments, assets, invoices
Data Source Description
doit_anomaly / doit_anomalies Get or list cost anomalies
doit_cloud_incident / doit_cloud_incidents Get or list cloud provider incidents
doit_commitment / doit_commitments Get or list commitments
doit_asset / doit_assets Get or list cloud assets
doit_invoice / doit_invoices Get or list invoices
doit_support_request / doit_support_requests Get or list support requests
doit_support_request_comments List comments on a support request
Organization — users, labels, annotations, platforms, datasets
Data Source Description
doit_annotation / doit_annotations Get or list annotations
doit_label / doit_labels Get or list labels
doit_label_assignments List label assignments
doit_datahub_dataset / doit_datahub_datasets Get or list DataHub datasets
doit_current_user Get current authenticated user
doit_users List users
doit_roles List available roles
doit_account_team Get account team information
doit_organizations List organizations
doit_platforms List available cloud platforms
doit_products List available cloud products
doit_ava Query the Ava AI assistant

Documentation


Development

Building the Provider

Requires Go >= 1.26.

git clone https://github.com/doitintl/terraform-provider-doit.git
cd terraform-provider-doit
go install

To generate or update documentation:

make docs

Using Nix Flake (Optional)

If you have Nix with flakes enabled:

nix develop          # or: direnv allow (for automatic activation)

This provides Go, Terraform, and golangci-lint at the pinned versions. To skip flake activation with direnv, set export DIRENV_SKIP_FLAKE=1 in your shell profile.

Acceptance Tests

Acceptance tests create real resources in a DoiT account. Use the following make targets:

# Run all acceptance tests
make testacc

# Run specific tests
make testacc-run TEST=TestAccBudget

Required Environment Variables

Copy the example file and fill in your values:

cp .envrc.example .envrc.local
# Edit .envrc.local with your values

The make testacc targets automatically source .envrc.local. If you use direnv, you can also run direnv allow to load the variables into your interactive shell.

Variable Description
DOIT_API_TOKEN Your DoiT API token
DOIT_HOST API host (e.g., https://api.doit.com)
TEST_USER Email for test budget collaborators/recipients
TEST_USER_2 Second user email for resource sharing tests
TEST_ATTRIBUTION Attribution ID for test budget scope
TEST_SLACK_CHAN Slack channel ID for notification tests
TEST_PROJECT Project ID for allocation rule tests
TEST_CUSTOMER_ID Customer ID for Slack channel recipient
Optional variables (specific data source tests are skipped if unset)
Variable Description
TEST_ATTRIBUTION_GROUP Attribution group ID for report tests
TEST_INVOICE_ID Invoice ID for invoice data source tests
TEST_ANOMALY_ID Anomaly ID for anomaly data source tests
TEST_CLOUD_INCIDENT_ID Cloud incident ID for cloud incident data source tests
TEST_COMMITMENT_ID Commitment ID for commitment data source tests
TEST_ASSET_ID Asset ID for asset data source tests (G Suite)
TEST_ASSET_ID_AWS AWS asset ID for asset data source tests
TEST_CLOUD_DIAGRAM_RESOURCE Cloud resource ID for cloud diagrams data source tests

Important

DoiT employees only: You must also set DOIT_CUSTOMER_CONTEXT to the same value as TEST_CUSTOMER_ID.

Warning

Acceptance tests create real resources and may incur costs.

About

Terraform provider for DoiT Cloud Intelligence™

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages