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 private IP -> sql_database_instance example documentation doesn't work #3342

Closed
pelissarisergioo opened this issue Mar 29, 2019 · 6 comments
Labels

Comments

@pelissarisergioo
Copy link

pelissarisergioo commented Mar 29, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.11.13

Affected Resource(s)

  • provider.google v2.3.0

Terraform Configuration Files

resource "google_compute_network" "private_network" {
    name       = "private-network"
}

resource "google_compute_global_address" "private_ip_address" {
    name          = "private-ip-address"
    purpose       = "VPC_PEERING"
    address_type = "INTERNAL"
    prefix_length = 16
    network       = "${google_compute_network.private_network.self_link}"
}

resource "google_service_networking_connection" "private_vpc_connection" {
    network       = "${google_compute_network.private_network.self_link}"
    service       = "servicenetworking.googleapis.com"
    reserved_peering_ranges = ["${google_compute_global_address.private_ip_address.name}"]
}

Expected Behavior

Setup the private network and PEER_VPC to attach into SQL Instance, I've also tried to use the google-beta provider

Actual Behavior

Error: google_compute_global_address.private_ip_address: : invalid or unknown key: network
Error: google_compute_global_address.private_ip_address: : invalid or unknown key: prefix_length
Error: google_compute_global_address.private_ip_address: : invalid or unknown key: purpose
Error: google_service_networking_connection.private_vpc_connection: Provider doesn't support resource: google_service_networking_connection

Steps to Reproduce

  1. Use the configuration below
resource "google_compute_network" "private_network" {
    name       = "private-network"
}

resource "google_compute_global_address" "private_ip_address" {
    name          = "private-ip-address"
    purpose       = "VPC_PEERING"
    address_type = "INTERNAL"
    prefix_length = 16
    network       = "${google_compute_network.private_network.self_link}"
}

resource "google_service_networking_connection" "private_vpc_connection" {
    network       = "${google_compute_network.private_network.self_link}"
    service       = "servicenetworking.googleapis.com"
    reserved_peering_ranges = ["${google_compute_global_address.private_ip_address.name}"]
}
  1. then terraform plan

Important Factoids

References

https://www.terraform.io/docs/providers/google/r/sql_database_instance.html

  • #0000
@rileykarson
Copy link
Collaborator

When using the google-beta provider did you explicitly set provider = "google-beta" on each resource? Per https://www.terraform.io/docs/providers/google/provider_versions.html#using-the-google-beta-provider, it's necessary unfortunately.

@pelissarisergioo
Copy link
Author

No, I've just replaced in the provider definition in providers.tf

@ghost ghost removed the waiting-response label Apr 3, 2019
@rileykarson
Copy link
Collaborator

Ah! As mentioned in those docs, you'll need to explicitly specify the provider. Unfortunately, Terraform implicitly uses the google provider if you don't, even with only google-beta defined.

@XANi
Copy link

XANi commented Apr 12, 2019

@rileykarson would be nice if examples actually stated that they need the beta provider, for example this one will flat out not work and there is no indication that the beta provider needs to be selected for it

@rileykarson
Copy link
Collaborator

@ghost
Copy link

ghost commented May 5, 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 👉 [email protected]. Thanks!

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

No branches or pull requests

3 participants