Skip to content

Commit

Permalink
docs: Remove the bearer token reference from README docs
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalsawale9 committed Sep 9, 2024
1 parent d74f2ce commit a79f1ad
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 37 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
BA_API_URI=
BA_BEARER_TOKEN=
EDB_TF_ACCESS_KEY=

#############################
Expand Down
11 changes: 3 additions & 8 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@

Please make sure to read the [Contributing guideline](./CONTRIBUTING.md) first.

## How to manage the BigAnimal Bearer Token?

As described in the [Readme](./README.md#getting-an-api-token) file, you can use the `get-token.sh` script to fetch a Bearer Token.

Another common practice is using the [Biganimal CLI](https://cli.biganimal.com/).

### Using BA CLI to help initializing Provider credentials
Expand Down Expand Up @@ -35,18 +31,17 @@ export_BA_env_vars () {
biganimal credential reset $cred_name
fi
biganimal cluster show -c $cred_name >&/dev/null
export BA_BEARER_TOKEN=$(biganimal credential show -o json| jq -r --arg CREDNAME "$cred_name" '.[]|select(.name==$CREDNAME).accessToken')
export BA_API_URI="https://"$(biganimal credential show -o json | jq -r --arg CREDNAME "$cred_name" '.[]|select(.name==$CREDNAME).address')/api/v3
export BA_CRED_NAME="$cred_name"
echo "$cred_name BA_BEARER_TOKEN and BA_API_URI are exported."
echo "$cred_name BA_API_URI is exported."
export TF_VAR_project_id="prj_$(ba_get_default_proj_id)"
echo "TF_VAR_project_id terraform variable is also exported. Value is $TF_VAR_project_id"
}
```
4. Now, you can use `export_BA_env_vars` command to manage your BA_BEARER_TOKEN and BA_API_URI environment variables, as well as TF_VAR_project_id terraform environment variable.
4. Now, you can use `export_BA_env_vars` command to manage your BA_API_URI environment variable, as well as TF_VAR_project_id terraform environment variable.
```console
$> export_BA_env_vars ba-user1
ba-user1 BA_BEARER_TOKEN and BA_API_URI are exported.
ba-user1 BA_API_URI is exported.
TF_VAR_project_id terraform variable is also exported. Value is prj_0123456789abcdef
```
5. If you would like to enable bash completion for the `export_BA_env_vars` command, you can add the following lines to your shellrc file:
Expand Down
18 changes: 2 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,17 @@ terraform {
provider "biganimal" {
# Configuration options
ba_bearer_token = <redacted> // See Getting an API Token section for details
ba_access_key = <redacted> // See Getting an Access Key section for details
}
```

You can also set the `BA_BEARER_TOKEN`, `BA_ACCESS_KEY` environment variables. When those environment variables are present, you
don't need to add any configuration options to the provider block described above. Only either `BA_BEARER_TOKEN` or `BA_ACCESS_KEY` needs to be set, if both are set then `BA_ACCESS_KEY` will take priority and be used.
You can also set the `BA_ACCESS_KEY` environment variable. When it is set as env var, you
don't need to add any configuration options to the provider block described above.

```bash
export BA_BEARER_TOKEN=<redacted>
export BA_ACCESS_KEY=<redacted>
```

> [!WARNING]
> OAuth2 authorization and thus `BA_BEARER_TOKEN` will be deprecated in future Terraform Provider releases. It is recommended to use `BA_ACCESS_KEY` as soon as you can.
### Getting an API Token

In order to access the BigAnimal API, it's necessary to fetch an api bearer token and either export it into your
environment or add this token to the provider block.

Please
visit [Using the get-token script](https://www.enterprisedb.com/docs/biganimal/latest/reference/api/#using-the-get-token-script)
for more details.

### Getting an Access Key

You can use an access key to access the BigAnimal API. The advantage of an access key compared to an API token is that it can be set to have a long expiry date which will aide automation.
Expand Down
2 changes: 1 addition & 1 deletion TESTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ We're using [terraform-plugin-testing](https://github.com/hashicorp/terraform-pl

For more information, please refer to the acceptance tests documentation.

In order to run the acceptance tests, several environment variables should be present. `BA_API_URI` and `BA_BEARER_TOKEN` to communicate with the Biganimal API.
In order to run the acceptance tests, several environment variables should be present. `BA_API_URI` to communicate with the Biganimal API.
We also use the `BA_TF_ACC_VAR_<resource_type>_<variable_name>` environment variables to run the acceptance tests. Example variable names can be found in the [.env.example](.env.example) file.

You can run the acceptance tests with the following command:
Expand Down
7 changes: 2 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ see [Getting started with the BigAnimal free trial.](https://www.enterprisedb.co
```terraform
# 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
// ba_access_key: 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>"
Expand All @@ -34,12 +32,11 @@ provider "biganimal" {

## Environment Variables

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

<!-- schema generated by tfplugindocs -->
## Schema

### Optional

- `ba_access_key` (String) BigAnimal Access Key
- `ba_bearer_token` (String) BigAnimal Bearer Token
5 changes: 0 additions & 5 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# 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
2 changes: 1 addition & 1 deletion templates/index.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ see [Getting started with the BigAnimal free trial.](https://www.enterprisedb.co

## Environment Variables

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

{{ .SchemaMarkdown | trimspace }}

0 comments on commit a79f1ad

Please sign in to comment.