In order to work with Terraform, you often need to identify what is the Terraform's state file will be stored. It may store on local machine or it can be stored on Azure Storage Account.
Following the best practice, it should be stored on an Storage account
Step 1: Create a resource group which will store Azure Storage account
Step 2: Create a Storage account which will store Terraform state
Step 3: Create a container name: terraform-state
Step 4: Copy the Access key to use later.Step 5: Following the instruction https://www.namptran.dev/2023/06/how-to-make-pretty-powershell-prompt.html to download and setup Azure CLI
Please be noted that:
- It must download Terraform https://developer.hashicorp.com/terraform/downloads.
- Login to Azure via Azure CLI. In case you have multiple Azure subscription, please set the default subscription will work to.
Finnal, you will fill info in the backend file of Terraform project
Run the command from the root of directory
terraform init
0 Comments
Post a Comment