Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

google_sql_database_instance ipv4_address flag no longer optional #3088

Closed
dbamohsin opened this issue Feb 20, 2019 · 2 comments
Closed

google_sql_database_instance ipv4_address flag no longer optional #3088

dbamohsin opened this issue Feb 20, 2019 · 2 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/sqladmin-cp

Comments

@dbamohsin
Copy link

Hi,

Terraform Version

0.11.11

Affected Resource(s)

google_sql_database_instance

Terraform Configuration Files

#_ operations specification
cloudsql_operations = {
    tier="db-f1-micro"
    disk_size=10
    disk_type="PD_SSD"
    mysqlver="MYSQL_5_7"
    user_host="cloudsqlproxy~%"
    charset   = "utf8"
    collation = "utf8_general_ci"
    binary_log_enabled = false
    backup_enabled = false
    backup_start_time = "00:00"
}

resource "google_sql_database_instance" "operations" {
  count            = "${lookup(var.cloudsql_operations, "operations")}"
  name             = "operations"
  database_version = "${lookup(var.cloudsql_operations, "mysqlver")}"
  project          = "${var.project}"
  region           = "${var.region}"

  settings {
    tier      = "${lookup(var.cloudsql_operations, "tier")}"
    disk_size = "${lookup(var.cloudsql_operations, "disk_size")}"
    disk_type = "${lookup(var.cloudsql_operations, "disk_type")}"

    location_preference {
      zone = "${var.zone}"
    }

    ip_configuration {
      ipv4_enabled        = true
      require_ssl         = true
      authorized_networks = "${var.authorized_networks}"
    }

    backup_configuration {
      binary_log_enabled = "${lookup(var.cloudsql_operations, "binary_log_enabled")}"
      enabled            = "${lookup(var.cloudsql_operations, "backup_enabled")}"
      start_time         = "${lookup(var.cloudsql_operations, "backup_start_time")}"
    }
    maintenance_window {
      day = 7
      hour = 2
    }
    database_flags = "${var.standard_mysql_flags}"
    user_labels {
      app = "operations"
    }
  }
}

Output

Error: Error applying plan:

1 error(s) occurred:

  • google_sql_database_instance.operations: 1 error(s) occurred:

  • google_sql_database_instance.operations: Error, failed to create instance operations: googleapi: Error 400: Invalid request: At least one of Public IP or Private IP connectivity must be enabled.., invalid

Expected Behavior

Based on the terraform documentation for the resource, we should not have to specify explicitly if the instance is using a public IP

Actual Behavior

Error applying Plan with an error:

* google_sql_database_instance.operations: Error, failed to create instance operations: googleapi: Error 400: Invalid request: At least one of Public IP or Private IP connectivity must be enabled.., invalid

Steps to Reproduce

  1. terraform apply

Resolution

Can be resolved by explicitly defining the ipv4_address to true in the ip_configuration block within the settings block

   ip_configuration {
      ipv4_enabled        = true
      require_ssl         = true
      authorized_networks = "${var.authorized_networks}"
    }
@rileykarson rileykarson self-assigned this Feb 20, 2019
@rileykarson
Copy link
Collaborator

rileykarson commented Feb 20, 2019

One of ipv4_enabled = true or a private_network value must be set; you can omit ipv4_enabled provided a private_network is defined. This is confirmed with the error message At least one of Public IP or Private IP connectivity must be enabled., where we enabled Public IP with ipv4_enabled and Private IP with private_network.

I'll add a note to the docs that one of them must be specified.

@ghost
Copy link

ghost commented Mar 23, 2019

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 23, 2019
@github-actions github-actions bot added forward/review In review; remove label to forward service/sqladmin-cp labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/sqladmin-cp
Projects
None yet
Development

No branches or pull requests

2 participants