Advanced Terraform¶
This topics is for more advanced users looking to expand what terraform can do. The following examples assume that you have created an app credential and have installed terraform.
The following link is to a repo with some more examples of what terraform can do:
https://github.com/wellsaar/terraform-js2
A brief overview of the code is below:
NGINX and MariaDB¶
This creates an ubuntu 22 server with NGINX and MariaDB installed and running, with a simple “Hello World!” webpage served as the index. This is an easy way to setup and have a baseline configuration for a web server.
Requirements¶
Set your key_pair in ubuntu22.auto.tfvars. This is the ssh public key that you have uploaded to Horizon. Add SSH Keys in Horizon
If would like the change the flavor of the instance you boot, add the following to ubuntu22.auto.tfvars.
flavor_id = "ID of flavor here"
You can see the list of flavor with the following command.
openstack flavor list
R + Shiny server (NGINX proxy)¶
This creates an ubuntu 22 server with NGINX, R and Shiny server installed and configure the NGINX server for SSL (using certbot) and reverse proxies back Shiny to port 443 (https).
You can specify which version of Shiny you want by editing shiny_version in ansible/main.yml once you have checked out the code above.
Requirements¶
Set your key_pair in ubuntu22.auto.tfvars. This is the ssh public key that you have uploaded to Horizon. Add SSH Keys in Horizon.
Set your email address for certbot.
Specify your domain_name if you would like. Otherwise a name will be generated for you.
If you would like to change your flavor, see above.
Kubernetes Cluster¶
This repo located below will setup a Kubernetes cluster with the amount of followers you specific.
Currently this is running on Ubuntu 20 and installs the latest version of Kubernetes.
https://github.com/wellsaar/terraform-js2-k8cluster
Requirements¶
Editing k8.tfvars with your public key as well. Add SSH Keys in Horizon.
If you would like to change the flavor or amount of followers in your cluster you can do so in k8.tfvars.