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:
A BigAnimal account with an organization set up. If you don't already have a BigAnimal account, see Getting started with BigAnimal.
Terraform (version 0.13x or later) downloaded and installed.
A BigAnimal API token for use within the Terraform application. See Getting an API Token.
Example usage
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 Keyba_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.
- Access the script located here.
- Open the script in
Raw
format. - Copy the script and save it locally with the name
get-token.sh
. - Modify permissions for the script in your local shell.
- Run the script locally using a command like the following:The resulting output instructs you to log in to a URL with an 8-digit user code. For example:
- In a browser, access the URL, confirm, and reauthenticate if necessary. A notice lets you know that the code was verified.
- In your local shell, a prompt asks:
- Enter
y
. The shell responds with output that provides the access token, refresh token, scope, expiration period, and token type. - Export the access token into your environment as follows, replacing
<REDACTED>
with the access token:Rather than export the token, you can alternatively use the token to set the value of theba_bearer_token
when configuring the BigAnimal provider, as shown in Example usage. - Now you can follow along with the examples in the Terraform repository.