Skip to content

A quick example that shows how to create a database and all resources available

License

Notifications You must be signed in to change notification settings

jdavies/hello_astra_tf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Astra-Terraform Demo

The purpose of this project is to show how to use Terraform to create an Astra database.

Prerequisites

  • Create a token with Admin User rights
  • Create a setenv.sh file with the following format:
export ASTRA_API_TOKEN=<Your Astra DB/API Token>
export KEYSPACE=callcenter
export ASTRA_DB_REGION=us-west1
export ASTRA_CLIENT_ID=<Your Astra Client ID>
export ASTRA_CLIENT_SECRET=<Your Astra Client Secret>
export ASTRA_ORGANIZATION=<Your Astra Organization ID>
  • Make your setenv.sh file executable:
chmod 700 setenv.sh

Running the code

Execute the following commands in the folder that contains your setenv.sh file:

source setenv.sh
terraform init
terraform plan -var="token=$ASTRA_API_TOKEN" -var="organization_id=$ASTRA_ORGANIZATION_ID" -out helloastra
terraform apply helloastra

To view the results

You can view the results of the Terraform code and all generated values with this command:

terraform output

To delete everything

terraform destroy -var="token=$ASTRA_API_TOKEN" -var="organization_id=$ASTRA_ORGANIZATION_ID"

Custom Roles

Custom roles (as shown in the resources.tf file) are based on an array of string values in the policy field. You can find a list of possible values for these strings here.

About

A quick example that shows how to create a database and all resources available

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages