Problem
When cost estimation is enabled on a Terraform Enterprise instance that is hosted on GCP, there is a chance you may get the following error when attempting to use cost estimation on your workspace.
panic: could not create Instance resolver: googleapi: Error 403:
Cloud Billing API has not been used in project XXXXXXXXXXX
before or it is disabled. Enable it by visiting
https://console.developers.google.com/apis/api/cloudbilling.googleapis.com
then retry. If you enabled this API recently, wait a few minutes
for the action to propagate to our systems and retry.
Cause
- The first time you use a new GCP project with Terraform Enterprise, the required Cloud Billing API needs to be enabled to successfully perform cost estimations.
Solutions:
- Enable the API for the affected project by visiting https://console.developers.google.com/apis/api/cloudbilling.googleapis.com
- Wait for a few minutes for the enablement to propagate through the GCP API system and subsequent Plans