NOTE: Still a work in progress...
- Use the Azure portal to create an Active Directory application and service principal that can access resources (this is for the Azure CLI)
- See here for the steps necessary to complete this.
- Additional information related to setting up the Terraform Microsoft Azure Provider can be found here.
- Credentials should be provided via the ARM_SUBSCRIPTION_ID, ARM_CLIENT_ID, ARM_CLIENT_SECRET and ARM_TENANT_ID environment variables.
- When assigning a role to your application, make sure to use something that has the appropriate access (instructions show "Reader" but you'll likely need a role with more privileges). See here for available built-in roles.
- This project contains two sub-projects:
base-infrastructure
: creates the Azure Resource Group, Storage Accounts, Virtual Networks/Subnets, a Bastion host, and runs aremote-exec
on the Bastion that uses the Azure CLI to create VN gateways and VPN connections.consul-nomad-clusters
: creates the Consul/Nomad clusters across the desired regions (assumesbase-infrastructure
exists).
Steps to deploy:
- Create the Azure Service Principal and associated credentials as described above.
- Change to the
base-infrastructure
directory and runterraform plan
&terraform apply
- Go grab some coffee or a beer (or two, or three). Wait roughly ~30 minutes as TF deploys the base infrastructure and the Azure CLI creates your VNet gateways (this latter step is the long running process).
- Once the
base-infrastructure
is provisioned, switch to theconsul-nomad-clusters
directory and runterraform plan
&terraform apply
- Once your clusters have been provisioned you can
ssh
into one (or all) of them to check your cluster status:- Consul:
consul members -wan
- Nomad:
nomad server-members
and alsonomad node-status
- Consul:
One caveat:
- You can use
terraform destroy
from theconsul-nomad-cluster
directory to tear down your clusters. However, this doesn't work properly for thebast-infrastructure
sub-project because we're building some resources manually via the Azure CLI. The easiest way to tear down the environment in this case is to go to the Azure Portal and simply delete the Resource Group, which will delete all associated resources.- NOTE: if you take this approach, make sure to delete your
terraform.tfstate*
.
- NOTE: if you take this approach, make sure to delete your
There's still a bunch of refactoring to do here...