Azure Deployment with Terraform – Part 2
Hi, welcome, everybody. In the last video we talked about some of the basic features in Terraform to deploy Azure assets, today in this part we will talk about some advanced
features but this feature is I think one of the most critical in terms of Azure Terraform deployment the feature is Terraform backend.
What it does basically is to store your state file we talked about state file in our in the first video state file is essentially the
entire code that has been generated by your Terraform and the deployment in your cloud, they both need to be in sync in the sense that if you
deploy a VM through Terraform it needs to match the exact same VM in your cloud account so if you change anything here it needs to be reflected and
deployed to the cloud to have both places in sync.
A lot of the times when the Terraform is being used people or developers just start
using on their machine, and they’ll have their own statefiles. Everyone who is in the team will have their own state files and if the developer leaves the
state files go with them and when the next developer comes in he/she’ll have a really hard time adjusting or finding out what are the
cloud deployments what sort of practices has been used to deploy the resources in the cloud.
So backend comes really handy in those situations where you just need to configure a backend feature in your Terraform deployment strategy and these state
files are stored centrally in a storage account in Azure or in AWS bucket if it’s an AWS and so forth.
This is very critical as I said in a team environment where you have multiple developers dealing with our deployments and everyone needs to have you
know a central location to store the straight files so when it comes to the configuration you all you need is just a back-end tfvar file and
specify the resource group storage account container name access key and the key which is the file itself that’s all you need in order to
have your state file stored in a central location in a back-end in terms of tariffs or Terraform nomenclature and in the Indy TTF file you need to
specify Terraform with the back-end resource which is in our case it as your RM but all you need is this just this piece of code and again
the execution is just you need to initialize the telephone state file with Terraform in it and back-end config it was the backend
configuration where ever we have it in our case this is the file name which is back end or tfvars so yeah it’s once you have that
it’s just going to create a directory under the storage account or in AWS bucket directory under a bucket and it’ll store files underneath
there if you change the location to a different region it will create regional directories under your stories account or about it
and it will create a state file in a different directory if you change the location to like east to west or so forth. So yeah it’s going
to create state file based on the location and the workspace when it comes to this the back end it belongs to a workspace workspaces
again a bit of an advanced feature but you can create multiple workspaces with multiple themes if you have multiple teams and you
know your developers are in different teams so you’ll manage those developers with multiple workspaces now this
will be discussed in coming videos but for this video, I just wanted to talk about only the backend feature in in Terraform so that’s it for
now this was a quick explanation of back-end but in next video, I’m just going to go ahead and execute this backend, and we’ll talk more about
workspaces in Terraform so if you have not subscribed to the channel please do so I’ll see you in the next video thank you.