我正在尝试使用postgresql提供程序在AWS中创建一个已创建的postgres RDS中的数据库。我创建的terraform脚本如下:
resource "aws_db_instance" "test_rds" {
allocated_storage = "" # gigabytes
backup_retention_period = 7 # in days
engine = ""
engine_version = ""
identifier = ""
instance_class = ""
multi_az = ""
name = ""
username = ""
password = ""
port = ""
publicly_accessible = "false"
storage_encrypted = "false"
storage_type = ""
vpc_security_group_ids = ["${aws_security_group.test_sg.id}"]
db_subnet_group_name = "${aws_db_subnet_group.rds_subnet_group.name}"
}
postgresql提供者如下所示:# Create databases in rds
provider "postgresql" {
alias = "alias"
host = "${aws_db_instance.test_rds.address}"
port = 5432
username =
password =
database =
sslmode = "disable"
}
# Create user in rds
resource "postgresql_role" "test_role" {
name =
replication = true
login = true
password =
}
# Create database rds
resource "postgresql_database" "test_db" {
name = testdb
owner = "${postgresql_role.test_role.name}"
lc_collate = "C"
allow_connections = true
provider = "postgresql.alias"
}
无论如何,我一直在检索错误:初始化PostgreSQL客户端时出错:检测功能时出错:PostgreSQL版本错误:pq:服务器上未启用SSL
注意:空字段已经填好,RDS已成功创建,在尝试使用postgresql提供程序在rds中创建数据库时出现问题。
provider = "postgresql.alias"
- Mr 123