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 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 and not for the underlying environment. To report suspected defects or to submit feature requests, 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_access_key: if set, this will be used instead of the ba_bearer_token above.
  // This can also be set as an environment variable. If it is set both here and
  // in an environment variable then the access key set in the environment variable
  // will take priority and be used
  ba_access_key = "<redacted>"
}
# Manage the resources

Environment Variables

Credentials can be provided by using the BA_BEARER_TOKEN or BA_ACCESS_KEY environment variables.

Schema

Optional

  • ba_access_key (String) BigAnimal Access Key
  • ba_bearer_token (String) BigAnimal Bearer Token

Getting an API token

To use the BigAnimal API, fetch an API bearer token and export it into your environment. (For additional information about using the BigAnimal API, see here.) Optionally, credentials can 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 reauthenticate if necessary. A notice lets you know that the code was verified.
  7. In your local shell, a prompt asks:
     Have you finished the login successfully. (y/n)
  8. 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, you can alternatively 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.