This repository uses Terraform and the CDKTF project to create Anaml definitions from Python code.
As CDKTF uses Terraform, the definitions are compared with the Anaml database and only differences are applied.
This setup is typically used in a CI pipeline where the definitions are kept in a source code repository and a CI job runs CDKTF on check-in to sync the definitions into Anaml.
This repository creates examples based on the TPC-DS dataset. This document assumes the reader is familiar with Anaml concepts.
The
Note: On Windows we recommend using WSL, and therefore following the Linux instructions.
- Install Terraform: https://developer.hashicorp.com/terraform/downloads
- Install NodeJS (required for CDKTF): https://nodejs.org/en/download/
- Install CDKTF: https://developer.hashicorp.com/terraform/tutorials/cdktf/cdktf-install
- Install pipenv: https://pipenv.pypa.io/en/latest/install/
- Export the following Environment variables:
export ANAML_URL=https://your.anaml.host/api export ANAML_APIKEY=your_api_key export ANAML_SECRET=your_api_secret
- Create a DataSource in Anaml called
tpcds_source
. It can be of any type and doesn't need to contain data unless you want to test the definitions. - Create a branch in Anaml called
cdktf_tpcds
. - Install the Python packages:
pipenv install
- Generate the CDKTF imports:
cdktf get
- Run a Diff/Plan to see what changes would be applied to the Anaml database:
cdktf plan
- Run a Deploy/Apply to make these changes to Anaml:
cdktf apply
If you receive this error:
cd cdktf.out/stacks/terraform
rm .terraform.lock.hcl
terraform init
cd -