I'am trying to create a google cloud sql instance via terraform and i have to enable point in time recovery option but I have the following error :
Error: Unsupported argument
on cloud-sql.tf line 39, in resource "google_sql_database_instance" "si_geny_postgres_logfaces": 39: point_in_time_recovery_enabled = true
An argument named "point_in_time_recovery_enabled" is not expected here.
here is my terraform file :
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
}
Any idea please?
Typically when you get these:
An argument named "..." is not expected here.
issues on terraform. First thing to check is that your file is correct and the property in the error is actually listed in the docs (which this one is).
Next thing is to check that your using the latest version of the provider. As properties are introduced they get added to the documentation but it's not always obvious which version of the provider they were added. You can check to see whichever is the latest provider from the release notes.
So you should upgrade your provider version to the latest (3.40.0) as of time of writing:
provider "google" {
version = "=3.40.0"
project = var.project_id
region = var.region
zone = var.gce_zone
}