Terraform – writing the code and deploying our infrastructure
Now that we know which services we are going to deploy, we can make a start on our Terraform deployment. To make things more manageable, I will split our code into several files; they will be named the following:
001-setup.tf
002-resource-group.tf
003-networking.tf
004-storage.tf
005-database.tf
006-vm-admin.tf
007-vmss-web.tf
098-outputs.tf
099-variables.tf
vm-cloud-init-admin.yml.tftpl
vmss-cloud-init-web.tftpl
I have done this to more logically group all the functions around a certain part of the deployment code together; for example, all of the networking elements can be found in the 003-networking.tf
file and the variables used in the 099-variables.tf
file.
Information
As mentioned at the start of this chapter, what follows is not 100% of the code contained within each of the files, and I will be referencing blocks out of the variables
file in line...