BigAnimal Terraform provider

BigAnimal’s Terraform provider is an infrastructure-as-code service that allows you to provision cloud resources with the Terraform CLI and incorporate those resources into your existing BigAnimal cloud infrastructure workflows.

The current version of the Terraform provider offers resources and data sources for creating, reading, updating, and deleting clusters and regions.

The current version of the Terraform provider offers resources and data sources for:

  • Creating, updating, and deleting clusters.
  • Creating, updating, and deleting faraway replicas. Promoting of a faraway replica isn't supported in the current version.
  • Activating and deactivating regions.
  • Creating projects. Connecting the cloud service provider isn't supported in the current version.

The Terraform provider is licensed under the MPL v2.

Note

We provide support for the BigAnimal Terraform provider itself and not for the underlying environment. To report suspected defects or to submit feature requests, please open a GitHub issue using the guidance found here.

Prerequisites

To use Terraform with BigAnimal, you need:

Example usage

# Configure the BigAnimal Provider
provider "biganimal" {
  ba_bearer_token = "<redacted>"
  //ba_api_uri = "https://portal.biganimal.com/api/v3" // Optional
}
# Manage the resources

Getting an API Token

To use the BigAnimal API, use the following procedure to fetch an API bearer token and export it into your environment. For additional information about using the BigAnimal API, see here.

Optionally, credentials can also be provided by using the BA_API_URI environment variable.

  1. Access the script located here.
  2. Open the script in Raw format.
  3. Copy the script and save it locally with the name get-token.sh.
  4. Modify permissions for the script in your local shell.
  5. Run the script locally using a command like the following:
     sh <local path>/get-token.sh
    The resulting output instructs you to log in to a URL with an 8-digit user code. For example:
     Please login to https://auth.biganimal.com/activate?user_code=JWPL-RCXL with your BigAnimal account
  6. In a browser, access the URL, confirm, and re-authenticate if necessary. You should receive a notice that the code has been verified.
  7. In your local shell a prompt asks:
     Have you finished the login successfully. (y/n)
  8. When you enter y, the shell responds with output that provides the access token, refresh token, scope, expiration period, and token type.
  9. Export the access token into your environment as follows, replacing <REDACTED> with the access token.
    export BA_BEARER_TOKEN=<REDACTED>
    Rather than export the token as described in this step, you can use the token to set the value of the ba_bearer_token when configuring the BigAnimal provider, as shown in Example usage.
  10. Now you can follow along with the examples in the Terraform repository.