View on GitHub

terrazura

Hasura + Azure + Terraform repo for code stream session on December 30th @ 10am.

terrazura

I created this repo during a live stream on my Twitch Thrashing Code Channel 🤘 at 10am on the 30th of December, 2020. The VOD is now available on my YouTube Thrashing Code Channel (click here for the direct link to video). A rough as hell year, but wanted to wrap it up with some solid content. In this stream I tackled a ton of specifics, in detail about getting Hasura deployed in Azure, Postgres backed, a database schema designed and created, using database schema migrations, and all sorts of tips n’ tricks along the way. 3 hours of solid how to get shit done material!

Deployment (i.e. Prerequisites)

You’ll need several CLI tools to use this repository for your own.

  1. Terraform - instructions & notes
  2. Azure CLI - instructions & notes
  3. Hasura CLI - instructions & notes

One those tools are available a few things need to be done with the aforementeiond tools.

The Azure CLI needs to be authenticated against Azure using the az login command. I wrote a post about setting up Terraform and the Azure CLI “Development Workspace with Terraform on Azure: Part 1 – Install and Setup Terraform and Azure CLI”, check it out for specific details on setting up these two tools. This deployment can be used just by setting up and using this option to authenticate and Terraform will use this authenticated CLI moving forward, however I’d highly suggest using a Service Principal. For more details about setting up a Service Principal I’ve got some details about authenticatig to Azure in “Development Workspace with Azure: Building a Packer Image”, in which the Packer image details aren’t pertinent to this but in section 5 of that post I cover in detail the intricacies of setting up an Azure Service Princpal and the environment variables that you’ll need.

The Hasura CLI needs to just be available and the scripts will utilize it apporpriately from within the folder structure of the project.

One these tools are made available and setup with the appropriate security and configuration, several environment variables need to be set so the launch scripts can pull the needed variable values to pass to Terraform for execution. The following are the environment variables needed:

Other variables are also set and passed in via the bash scripts included in the repo, check out the terraformapply.sh or terraformdestroy.sh files to see where you can change those to your liking.

One all of these tools are installed, configured appropriately, and the environment variables set you’re all good to go to launch per the following scripts. To terraform apply and deploy this Hasura API and Postgres Database, run:

./terraformapply.sh

Then when you’re done using the environment run the script to destroy it:

./terraformdestroy.sh

How To, Video, and Blog Details About This Project

Picture at Time in Point of the Video

Some of the things covered:

Time Points: