Search code examples
azureazure-storage-account

Terraform State File in storage account


We have Terraform state file stored in the Azure Storage Account. In case storage account went down we will be screwed. What is the best way to store the file? where?


Solution

  • AFAIK, there are two methods to store a terraform state file i.e. Locally in your machine or in a Storage account in azure .

    In case storage account went down we will be screwed. What is the best way to store the file? where?

    As confirmed , You are using Standard_LRS which is not preferred as per the Microsoft Document if you are looking for high availability.

    Locally redundant storage (LRS) copies your data synchronously three times within a single physical location in the primary region. LRS is the least expensive replication option, but is not recommended for applications requiring high availability or durability.

    So, as a solution you can change the storage account type as per your requirement to Standard_GRS or Standard_ZRS so that your data is present in two locations i.e. replicated.

    enter image description here

    enter image description here

    You can change it by going to your storage account>>Configuration>>replication as shown below:

    enter image description here

    If You want more details on Disaster recovery (if one location is down) or data protection from Accidental Deletes then please refer the below documents:

    Disaster recovery and storage account failover - Azure Storage | Microsoft Docs

    Soft delete for containers - Azure Storage | Microsoft Docs