Set up the Cloudability native task
The Cloudability native task allows you to integrate Cloudability into your Terraform runs and perform the following actions:
- Estimate cost: Project the cost impact your infrastructure changes.
- Enforce policy: Enforce Cloudability financial operation (FinOps) policies on your Terraform runs.
- Suggested optimizations: Receive insights into how you can better optimize your infrastructure.
The Cloudability native task runs between the plan and apply phase of your Terraform runs.
Requirements
To use the Cloudability native task, you must meet the following requirements:
- Owner access in a Terraform Enterprise, HCP Terraform Standard, or HCP Terraform Premium organization.
- Administrator access to a Cloudability Standard or Premium account with permission to create an access key and secret key. Refer to the Getting started with Cloudability API documentation for more information.
- If using agent execution mode, agents must be version 1.31.1 or later.
Networking requirements
If your Terraform runs use the agent execution mode, or you use Terraform Enterprise, you must ensure that your agents can reach the following fully qualified domain name (FQDN) for your Cloudability region. You use the authentication and API domains for your Cloudability region when you configure the native task.
| Cloudability Region | Authentication FQDN | API FQDN |
|---|---|---|
| United States | frontdoor.apptio.com | api.cloudability.com |
| Europe | frontdoor-eu.apptio.com | api-eu.cloudability.com |
| Australia | frontdoor-au.apptio.com | api-au.cloudability.com |
| Canada | frontdoor-ca.apptio.com | api-ca.cloudability.com |
| Japan | frontdoor-jp.apptio.com | api-jp.cloudability.com |
| India | frontdoor-in.apptio.com | api-in.cloudability.com |
| Middle East (EU DR) | frontdoor-eu.apptio.com | api-eu-dr.cloudability.com |
Configure the Cloudability native task
To enable the Cloudability native task in your HCP Terraform or Terraform Enterprise organization, complete the following steps:
- Open your HCP Terraform organization's Settings page.
- Click Native Tasks in the left navigation panel.
- Click Connect IBM Cloudability.
- Enter the following information. Refer to Networking requirements for information on the Cloudability API and Frontdoor URLs.
- Your Cloudability URL API endpoint
- Your Cloudability Frontdoor URL
- Your Cloudability Access Key and Secret Key. This account must have the Cloudability Governance Automation User role.
- Your Apptio Environment ID. This is a 32-character alphanumeric string separated into five groups by hyphens.
- Click Next.
The next screen lets you choose to scope the Cloudability native task and configure how HCP Terraform or Terraform Enterprise enforces the native task. Complete the following steps to scope the Cloudability native task:
- Choose a Scope of task.
- Apply task globally: This option runs the Cloudability native task on every workspace in the organization.
- Apply task to selected project: The native task only runs on the workspaces in the specified projects. Enter the projects you want to enforce this task on in the Enforced on section of the settings.
- Choose an Enforcement behaviour.
- Advisory: Failed gated policies produce a warning but do not block you from applying the plan.
- Mandatory: Failed gated policies block you from completing the run.
- Click Save.
Configure usage cost estimation
You can optionally provide usage estimates to help Cloudability better calculate the cost to run your infrastructure. To provide this information for a Terraform workspace, create a file named usage.json in the root of your Terraform configuration to provide usage estimates to Cloudability. For example, the following configuration tells Cloudability that you estimate the aws_s3_bucket.new_bucket resource to store 250GB of data:
{
"version": "0.1",
"resource_usage": {
"aws_s3_bucket.new_bucket": {
"standard_storage": {
"storage_gb": 250
}
}
}
}
Refer to the Usage and Configuration-Based Cost Estimation documentation for more information on how to create usage estimates.