我正在尝试通过terraform创建一个google cloud sql实例,我必须启用时间点恢复选项,但是出现以下错误:
错误:参数不受支持
在cloud-sql.tf第39行中,在资源“ google_sql_database_instance”,“ si_geny_postgres_logfaces”中: 39:point_in_time_recovery_enabled = true
此处不应使用名为“ point_in_time_recovery_enabled”的参数。
这是我的Terraform文件:
resource "google_sql_database_instance" "si_geny_postgres_logfaces" {
project = google_project.current_project.project_id
region = var.region
name = "si-sql-instance"
database_version = "POSTGRES_12"
lifecycle {
prevent_destroy = true
ignore_changes = [
settings[0].disk_size, name
]
}
settings {
tier = "db-custom-2-7680"
availability_type = "REGIONAL"
ip_configuration {
ipv4_enabled = false
private_network = data.google_compute_network.si_shared_vpc.self_link
}
location_preference {
zone = var.gce_zone
}
#disk
disk_type = "PD_SSD"
disk_autoresize = true
disk_size = 10 #GB
backup_configuration {
binary_log_enabled = false
point_in_time_recovery_enabled = true
enabled = true
start_time = "00:00" // backup at midnight (GMT)
location = var.region // Custom Location for backups => BACKUP REGION
}
maintenance_window {
day = 1
hour = 3
update_track = "stable"
}
}
}
main.tf
terraform {
required_version = ">0.12.18"
}
provider "google" {
version = "=3.20.0"
project = var.project_id
region = var.region
zone = var.gce_zone
}
provider "google-beta" {
version = "=3.20.0"
project = var.project_id
region = var.region
zone = var.gce_zone
}
请问有什么主意吗?
答案 0 :(得分:2)
通常,当您得到这些时:
此处不应使用名为“ ...”的参数。
在地形上发出。首先要检查的是文件是否正确,错误中的属性实际上已在文档(which this one is)中列出。
下一步是检查您使用的是最新版本的提供程序。引入属性后,它们便被添加到文档中,但是添加它们的提供者版本并不总是很明显。您可以查看release notes中最新的提供者。
因此,您应在撰写本文时将提供程序的版本升级到最新版本(3.40.0):
provider "google" {
version = "=3.40.0"
project = var.project_id
region = var.region
zone = var.gce_zone
}