Unable setting option that the settings.ipconfiguration.ipv4_enabled to false when create or update google_sql_database_instance by terraform.
Maybe, the reason is that the parameter is lost when reqeust to Google API.
I want to set the option on reqeust for Google API.
Terraform v0.11.11
+ provider.google v1.20.0
// Create Cloud SQL for xxx
resource "google_sql_database_instance" "db-instance-hogehoge" {
name = "hogehoge"
region = "asia-northeast1"
database_version = "POSTGRES_9_6"
settings {
tier = "db-custom-2-8192"
disk_type = "PD_SSD"
disk_size = "${lookup(var.disk_size_xxx, "${terraform.workspace}")}"
disk_autoresize = "true"
availability_type = "REGIONAL"
maintenance_window = {
day = "7"
hour = "21"
}
ip_configuration {ใใใใใใใใใใใใใใใใใใใใใใใใใใ//โใ
ipv4_enabled = "false" //โ
private_network = "projects/pjname/global/networks/hogehoge" //โ
}
}
}
// Set postgres Password
resource "google_sql_user" "hogehoge-postgres-user" {
name = "postgres"
instance = "${google_sql_database_instance.db-instance-hogehoge.name}"
password = "postgres"
}
``` :example
terraform apply
[...]
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
~ update in-place
Terraform will perform the following actions:
~ google_sql_database_instance.db-instance-hogehoge
settings.0.ip_configuration.0.ipv4_enabled: "true" => "false"
Plan: 0 to add, 1 to change, 0 to destroy.
```
terraform apply)terraform plan)When any instance create, the ipv4_enabled is lost from request for Google API.(Please see Debug Output "case created instance" line 20.)
When any instance update, the private_network and the ipv4_enabled (or all ip_configration option?) is lost from request for Google API.(Please see Debug Output "case updated instance" line 54.)
I think I am seeing this as well. After enabling Private IP, and future updates cause this error:
Error, failed to update instance xxx: googleapi: Error 400: This operation isn"t valid for this instance., invalidOperation
Are you using the google-beta provider?
This should be fixed in 2.0.0, once that's released please feel free to comment on this issue / open a new one.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error ๐ค ๐ , please reach out to my human friends ๐ [email protected]. Thanks!
Most helpful comment
This should be fixed in
2.0.0, once that's released please feel free to comment on this issue / open a new one.