EDB Cloud Service Terraform provider
The Terraform provider of EDB Postgres AI® Cloud Service is an infrastructure-as-code service that allows you to provision cloud resources with the Terraform CLI and incorporate those resources into your existing EDB Cloud Service 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 Cloud Service 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 Cloud Service, you need:
An EDB Postgres AI Cloud Service account with an organization set up. If you don't already have an account, see Getting started with Cloud Service.
Terraform (version 0.13x or later) downloaded and installed.
A Cloud Service 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) Cloud Service Access Keyba_bearer_token
(String) Cloud Service Bearer Token
Getting an API token
To use the Cloud Service API, fetch an API bearer token and export it into your environment. (For additional information about using the Cloud Service 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 Cloud Service provider, as shown in Example usage. - Now you can follow along with the examples in the Terraform repository.
Could this page be better? Report a problem or suggest an addition!