大网数据广告活动
服务器运维问答

Terraform postgres provider not recognize Azure Postgresql database version

· 52CE 我爱测

I would create a postgresql database in azure and after it I would connect with the postgresql provider Here is how I create the database resource "azurerm_postgresql_server" "qumulateserver" { name = "${var.database_server_name}…

问题原文

原帖链接 · GergA · CC BY-SA 3.0

I would create a postgresql database in azure and after it I would connect with the postgresql provider

Here is how I create the database

resource "azurerm_postgresql_server" "qumulateserver" {
name                = "${var.database_server_name}"
location            = "${azurerm_resource_group.qumulateterraform.location}"  
resource_group_name = "${azurerm_resource_group.qumulateterraform.name}"

sku {
name = "PGSQLB50"
capacity = 50
tier = "Basic"
}

administrator_login = "admin"
administrator_login_password = "password"
version = "9.5"
storage_mb = "51200"
ssl_enforcement = "Enabled"
}

Here how I would connect

provider "postgresql" {
alias = "pgconnect"
host = "${var.database_server_name}${var.postgres_fqdn}"
port = 5432
database = "${var.database_name}"
username = "${azurerm_postgresql_server.qumulateserver.administrator_login}@${var.database_server_name}${var.postgres_fqdn}"
password = "${azurerm_postgresql_server.qumulateserver.administrator_login_password}"
expected_version = "9.5.0"
}

So the probelm is with the versions. I get the following error Error: Error refreshing state: 1 error(s) occurred:

* provider.postgresql.pgconnect: Error initializing PostgreSQL client: error detecting capabilities: error parsing version: Invalid character(s) found in patch number "9,"

I tried to change the db versions to the same minor and patchset versions but doesn't help. What can I do?

已采纳解答

原帖链接 · Shui shengbao · CC BY-SA 3.0

It seems you don't use the latest version Terraform. I test in my lab, your tf file works for me. You could check the version with

 terraform -v

The following is my result.

[root@shui ~]# terraform -v
Terraform v0.11.3
+ provider.azurerm v1.1.0
+ provider.postgresql v0.1.1

If you don't use the latest version, I suggest you could download it from https://releases.hashicorp.com/terraform/0.11.3/terraform_0.11.3_linux_amd64.zip?_ga=2.218208986.2119762406.1517451738-1224081222.1513669056

The tf file works for me. You could check it.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-01-31)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。