请问如何将此 ARM Concat 字符串转换为 Terraform Concat
How do I convert this ARM Concat string to Terraform Concat please
我已经尝试了几个小时来找出如何将此 ARM Concat String 转换为 Terraform Concat String。
"[Concat('DefaultEndpointsProtocol=https;AccountName=', parameters('accountName'), ';AccountKey=', parameters('accountKey'), ';EndpointSuffix=core.windows.net')]"
Terraform 我目前拥有的东西
value = Concat(['DefaultEndpointsProtocol=https;AccountName=', parameters('azurerm_storage_account.website_storage_account')], [';AccountKey=', parameters('zurerm_storage_account.website_storage_account.primary_access_key'),] ';EndpointSuffix=core.windows.net')]"
也试过
format("DefaultEndpointsProtocol=https"";"""AccountName="%s{azurerm_storage_account.website_storage_account}";""""AccountKey="%s{azurerm_storage_account.website_storage_account.primary_access_key}";"EndpointSuffix=core.windows.net")
我想要实现的是将这两个值:azurerm_storage_account.website_storage_account
& azurerm_storage_account.website_storage_account.primary_access_key
放在字符串中正确的位置:
DefaultEndpointsProtocol=https;AccountName={acountName};AccountKey={accountKey};EndpointSuffix=core.windows.net
如果我遗漏了什么,我深表歉意,但我认为这比最初看起来要简单。
value = "DefaultEndpointsProtocol=https;AccountName=${azurerm_storage_account.website_storage_account.name};AccountKey=${azurerm_storage_account.website_storage_account.primary_access_key};EndpointSuffix=core.windows.net"
在 ""
中包含的字符串中,可以在 ${}
中插入 Terraform 资源属性。
我还将 azurerm_storage_account.website_storage_account
修改为 azurerm_storage_account.website_storage_account.name
,因为您必须指定资源的属性,而不仅仅是资源。我猜想 name
是你在这里需要的,但你可以看看替代属性 here
我已经尝试了几个小时来找出如何将此 ARM Concat String 转换为 Terraform Concat String。
"[Concat('DefaultEndpointsProtocol=https;AccountName=', parameters('accountName'), ';AccountKey=', parameters('accountKey'), ';EndpointSuffix=core.windows.net')]"
Terraform 我目前拥有的东西
value = Concat(['DefaultEndpointsProtocol=https;AccountName=', parameters('azurerm_storage_account.website_storage_account')], [';AccountKey=', parameters('zurerm_storage_account.website_storage_account.primary_access_key'),] ';EndpointSuffix=core.windows.net')]"
也试过
format("DefaultEndpointsProtocol=https"";"""AccountName="%s{azurerm_storage_account.website_storage_account}";""""AccountKey="%s{azurerm_storage_account.website_storage_account.primary_access_key}";"EndpointSuffix=core.windows.net")
我想要实现的是将这两个值:azurerm_storage_account.website_storage_account
& azurerm_storage_account.website_storage_account.primary_access_key
放在字符串中正确的位置:
DefaultEndpointsProtocol=https;AccountName={acountName};AccountKey={accountKey};EndpointSuffix=core.windows.net
如果我遗漏了什么,我深表歉意,但我认为这比最初看起来要简单。
value = "DefaultEndpointsProtocol=https;AccountName=${azurerm_storage_account.website_storage_account.name};AccountKey=${azurerm_storage_account.website_storage_account.primary_access_key};EndpointSuffix=core.windows.net"
在 ""
中包含的字符串中,可以在 ${}
中插入 Terraform 资源属性。
我还将 azurerm_storage_account.website_storage_account
修改为 azurerm_storage_account.website_storage_account.name
,因为您必须指定资源的属性,而不仅仅是资源。我猜想 name
是你在这里需要的,但你可以看看替代属性 here