【发布时间】:2020-08-28 12:28:48
【问题描述】:
我正在尝试使用 azurerm_postgresql_server 资源块在 Azure 上创建 Postgres 服务器。我将azurerm 版本固定到2.4.0,这意味着我应该是最新的并且可以使用documentation 中的示例。相反,我缺少必需的参数错误,并且看到消息引用缺少的属性,根据文档已弃用。
到目前为止,我已经尝试运行terraform init -upgrade,以防我之前尝试使用旧版本的提供程序创建 Postgres,它导致了插件的缓存版本,但它没有任何效果。我不知道出了什么问题 - 如果是代码本身还是我机器上的 terraform 设置。简化代码sn-p和错误输出如下,谢谢!
provider "azurerm" {
version = "=2.4.0"
subscription_id = "xxxxxxxxxxxxxxx"
features {
key_vault {
purge_soft_delete_on_destroy = true
}
}
}
resource "azurerm_postgresql_server" "postgres" {
name = "sarum-hymnal-postgresql-server"
location = var.resource_group.location
resource_group_name = var.resource_group.name
sku_name = "B_Gen4_1"
storage_mb = 5120
backup_retention_days = 7
geo_redundant_backup_enabled = false
auto_grow_enabled = false
administrator_login = data.azurerm_key_vault_secret.POSTGRES-USERNAME.value
administrator_login_password = data.azurerm_key_vault_secret.POSTGRES-SECRET.value
version = "11"
ssl_enforcement_enabled = true
tags = var.resource_group.tags
}
Error: Missing required argument
on sarum-hymnal/main.tf line 26, in resource "azurerm_postgresql_server" "postgres":
26: resource "azurerm_postgresql_server" "postgres" {
The argument "ssl_enforcement" is required, but no definition was found.
Error: Unsupported argument
on sarum-hymnal/main.tf line 31, in resource "azurerm_postgresql_server" "postgres":
31: storage_mb = 5120
An argument named "storage_mb" is not expected here.
通过在根目录运行terraform providers,我得到以下输出:
.
├── provider.azurerm =2.4.0
├── module.early-modern-ballot
│ └── provider.azurerm (inherited)
├── module.hands-on-reading
│ └── provider.azurerm (inherited)
├── module.poetic-transformations
│ └── provider.azurerm (inherited)
├── module.sarum-hymnal
│ └── provider.azurerm (inherited)
├── module.soundscapes-of-text
│ └── provider.azurerm (inherited)
└── module.translations
└── provider.azurerm (inherited)
【问题讨论】:
-
能否在根配置目录中显示
azurerm提供程序的版本? -
通过在根目录运行
terraform providers,我得到以下输出:. ├── provider.azurerm =2.4.0 ├── module.early-modern-ballot │ └── provider.azurerm (inherited) ├── module.hands-on-reading │ └── provider.azurerm (inherited) ├── module.poetic-transformations │ └── provider.azurerm (inherited) ├── module.sarum-hymnal │ └── provider.azurerm (inherited) ├── module.soundscapes-of-text │ └── provider.azurerm (inherited) └── module.translations └── provider.azurerm (inherited) -
terraform version的输出是什么? -
terraform 版本为 0.12
标签: terraform terraform-provider-azure