GoogleCloudPlatform / terraform-google-alloy-db

Creates an Alloy DB instance
https://registry.terraform.io/modules/GoogleCloudPlatform/alloy-db/google
Apache License 2.0
17 stars 17 forks source link

`network_self_link` isn't a self link #79

Closed ashleyghooper closed 2 weeks ago

ashleyghooper commented 5 months ago

The network_self_link attribute actually will not accept a network's self_link. If a self link is provided, an error like the below is seen:

Error: Error creating Cluster: googleapi: Error 499: malformed network path: "https://www.googleapis.com/compute/v1/projects/myproject123/global/networks/mynetworkname"

The usage example in the main README.md composes the value as below:

  network_self_link = "projects/${project_id}/global/networks/${network_name}"

I believe that format is known as a resource's id. In my experience, the convention is to pass self_links around, so ideally the module internals would be changed to support accepting an actual self_link (perhaps falling back to accepting an id if possible).

imrannayer commented 5 months ago

@ashleyghooper According to the doc it accepts network ID. I think we can add mode details in description or perhaps add another variable network_id and deprecate network_self_link variable.

variable "network_self_link" {
  description = "Network ID where the AlloyDb cluster will be deployed."
  type        = string
}
ashleyghooper commented 5 months ago

Hi @imrannayer, thanks for your reply. I just noticed looking at a Compute instance just now in the GCP Console and clicking the Equivalent REST response, that the selfLink property is also specified without the https://www.googleapis.com/compute/... prefix.

Maybe my assumption that self links should always be full URLs is incorrect?

github-actions[bot] commented 3 months 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

imrannayer commented 2 months ago

seems like self link and ID have same value

github-actions[bot] commented 3 weeks 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