terraform-google-modules / terraform-google-sql-db

Creates a Cloud SQL database instance
https://registry.terraform.io/modules/terraform-google-modules/sql-db/google
Apache License 2.0
264 stars 417 forks source link

ip_configuration - enable_private_path_for_google_cloud_services #442

Closed sherintky closed 1 year ago

sherintky commented 1 year ago

TL;DR

The parameter "enable_private_path_for_google_cloud_services" under " ip_configuration" is not enabled in google module. Hence we are unable to enable it from terraform. When we enable it from console, terraform is overwriting the value to null. This parameter is available in terraform resource, but not available in the google module. When we try to add this parameter in lifecycle ignore changes, it is not accepting. Error is "The block type name "lifecycle" is reserved for use by Terraform in a future version". Please advise.

Terraform Resources

resource "google_sql_database_instance" "instance" {
  provider = google-beta

  name             = "private-instance-${random_id.db_name_suffix.hex}"
  region           = "us-central1"
  database_version = "MYSQL_5_7"

  depends_on = [google_service_networking_connection.private_vpc_connection]

  settings {
    tier = "db-f1-micro"
    ip_configuration {
      ipv4_enabled                                  = false
      private_network                               = google_compute_network.private_network.id
      enable_private_path_for_google_cloud_services = true
    }
  }
}

Detailed design

Terraform plan when private path enabled from console

 ~ resource "google_sql_database_instance" "default" {
        id                             = "prsql-for-testing"
        name                           = "prsql-for-testing"
        # (14 unchanged attributes hidden)

      ~ settings {
            # (12 unchanged attributes hidden)

          ~ ip_configuration {
              - enable_private_path_for_google_cloud_services = true -> null
                # (3 unchanged attributes hidden)
            }

            # (15 unchanged blocks hidden)
        }

        # (1 unchanged block hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Additional information

No response

disusered commented 1 year ago

We are also having issues with this, seems to be a new toggle for Cloud SQL.

ipardogranillo commented 1 year ago

Same issue here, this flag is not being recognized by terraform.

sherintky commented 1 year ago

@ravisiddhu : Thanks for enabling the private path. It looks there is constrain that from CFT version 14.0.0 onwards minimum terraform provider version >= 1.3.0. But we are using terraform 0.13.5 and 1.2.0 version in our environment. Could you please advise how can we enable private path for terraform 0.13.5 and 1.2.0.

sherintky commented 1 year ago

@ravisiddhu : Thanks for enabling the private path. It looks there is constrain that from CFT version 14.0.0 onwards minimum terraform provider version >= 1.3.0. But we are using terraform 0.13.5 and 1.2.0 version in our environment. Could you please advise how can we enable private path for terraform 0.13.5 and 1.2.0.

Can you please provide an update.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days