存储帐户中的 Terraform 状态文件

Terraform State File in storage account

我们将 Terraform 状态文件存储在 Azure 存储帐户中。万一存储帐户出现故障,我们就完蛋了。存储文件的最佳方式是什么?在哪里?

据我所知,有两种方法可以存储 terraform 状态文件,即本地存储在您的计算机中或存储在 azure 中的存储帐户中。

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

经确认,如果您正在寻找高可用性,您正在使用 Standard_LRS 根据 Microsoft Document 不是首选。

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.

因此,作为一种解决方案,您可以根据需要将存储帐户类型更改为 Standard_GRSStandard_ZRS,以便您的数据存在于两个位置,即复制。

您可以通过转到您的存储帐户>>配置>>复制来更改它,如下所示:

如果您想了解有关灾难恢复(如果一个位置出现故障)或数据保护免受意外删除的更多详细信息,请参阅以下文档:

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

Soft delete for containers - Azure Storage | Microsoft Docs