从 Azure 文件共享获取访问密钥 - Terraform

Get Access key from Azure file share - Terraform

我正在尝试根据此 Example 通过 terraform 创建一个 azure file share,但是我想为此 storage account 获取 Access Key .我如何得到它,如有任何帮助,我们将不胜感激。

您无法获得 azurerm_storage_share 访问密钥,因为此属性未公开。您需要从 azurerm_storage_account.

获取 access key

代码段:

data "azurerm_storage_account" "example" {
  name                = "packerimages"
  resource_group_name = "packer-storage"
}

output "storage_account_primary_access_key" {
  value = data.azurerm_storage_account.example.primary_access_key
}

此外,在每个组件下,您可以找到Attributes Reference下公开的属性。

可以找到更多信息 here