Requires Terraform 0.12+
Terraform is a simple and powerful tool that lets us write, plan and create infrastructure as code. This code will allow you to efficiently provision the infrastructure required to run the Astronomer platform.
This repo uses the following Terraform modules:
| Module |
|---|
| astronomer/astronomer-gcp/google |
| astronomer/astronomer-system-components/kubernetes |
| astronomer/astronomer/kubernetes |
These modules are downloaded from Terraform Registry into a local .terraform directory.
-
Set Google application default credentials:
gcloud auth application-default login
-
Create Terraform Variables file (
terraform.tfvars):A sample
terraform.tfvars.samplefile is provided in the repo. You can remove.samplefrom the filename and update the values based on your environment.Example:
email = "kaxil@astronomer.io" deployment_id = "staging" dns_managed_zone = "steven-zone" management_api = "public" -
Copy
providers.tf.example& rename it toproviders.tfand replacePROJECTwith your GCP Project ID:cp providers.tf.example providers.tf export PROJECT=GCP_PROJECT_ID sed -i "s/PROJECT/$PROJECT/g" providers.tf
-
(Optional) If you want to use remote Terraform state file, copy
backend.tf.example& rename it tobackend.tf& replaceBUCKET&REPLACEwith appropriate values.cp backend.tf.example backend.tf export DEPLOYMENT_ID=DEPLOYMENT_ID # Set this value export STATE_BUCKET=STATE_BUCKET # Set this value sed -i "s/REPLACE/$DEPLOYMENT_ID/g" backend.tf sed -i "s/BUCKET/$STATE_BUCKET/g" backend.tf
-
Run the
deploy.shbash script:bash deploy.sh terraform.tfvars
OR
./deploy.sh terraform.tfvars
This bash script would run all the necessary Terraform steps.
-
Run the following command:
./destroy.sh terraform.tfvars