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

Cloud SQL does not expose IP through address 0 #352

Closed
johnsonj opened this issue Aug 24, 2017 · 2 comments · Fixed by #357
Closed

Cloud SQL does not expose IP through address 0 #352

johnsonj opened this issue Aug 24, 2017 · 2 comments · Fixed by #357
Assignees

Comments

@johnsonj
Copy link
Contributor

Cloud SQL IP is no longer accessible in the way it used to be

Versions

Previous working version:
v0.9.11

Tested breaking version:
v0.10.2, google provider: v0.1.3

Repro

variable "project" {
  type = "string"
}

provider "google" {
  region      = "us-east"
  project     = "${var.project}"
}

resource "random_id" "db-name" {
  byte_length = 8
}

resource "google_sql_database_instance" "service_broker" {
  region           = "us-east1"
  database_version = "MYSQL_5_6"
  name             = "db-${replace(lower(random_id.db-name.b64), "_", "-")}"
  project          = "${var.project}"

  settings {
    tier = "db-f1-micro"

    ip_configuration = {
      ipv4_enabled = true

      authorized_networks = [
        {
          name  = "all"
          value = "0.0.0.0/0"
        },
      ]
    }
  }
}

output "service_broker_db_ip" {
  value = "${google_sql_database_instance.service_broker.ip_address.0.ip_address}"
}

Expected

IP can be referenced by: ${google_sql_database_instance.service_broker.ip_address.0.ip_address}

Actual

Output is empty.

$ terraform output -json
The state file either has no outputs defined, or all the defined
outputs are empty. Please define an output in your configuration
with the `output` keyword and run `terraform refresh` for it to
become available. If you are using interpolation, please verify
the interpolated value is not empty. You can use the 
`terraform console` command to assist.

Extras

It looks like terraform thinks Cloud SQL has two IPs now. You could probably use ${google_sql_database_instance.service_broker.ip_address.1.ip_address} but that's not as it's documented (or how it used to work)

terraform.tfstate:

"id": "omg-ci-nvf-jbnbbzo",
"attributes": {
    "database_version": "MYSQL_5_6",
    "id": "omg-ci-nvf-jbnbbzo",
    "ip_address.#": "2",
    "ip_address.1.ip_address": "<<REDACTED>>",
    "ip_address.1.time_to_retire": "",
@johnsonj johnsonj changed the title Cloud SQL IP Unexpected Change Cloud SQL does not expose IP through address 0 Aug 24, 2017
@selmanj
Copy link
Contributor

selmanj commented Aug 24, 2017

I'm able to reproduce this; bug fix coming...

@selmanj selmanj self-assigned this Aug 24, 2017
johnsonj added a commit to vmware-archive/gcp-pcf-quickstart that referenced this issue Nov 30, 2017
johnsonj added a commit to vmware-archive/gcp-pcf-quickstart that referenced this issue Nov 30, 2017
luis-silva pushed a commit to luis-silva/terraform-provider-google that referenced this issue May 21, 2019
Add custom flatten for monitoring channel labels
@ghost
Copy link

ghost commented Mar 31, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants