equinix / terraform-equinix-metal-multiarch-k8s

ARM and x86 Kubernetes Clusters and Node Pool management for Equinix Metal
https://registry.terraform.io/modules/equinix/multiarch-k8s/metal/latest
32 stars 22 forks source link

Reference/Create New Project by Name Rather than ID #121

Open jmarhee opened 8 months ago

jmarhee commented 8 months ago

Convenience update: rather than needing the ID, user can specify (or define for creation) a project by its name rather than ID (and then ID is rendered via datasource). Changes variable from project_id to project_name and updates module accordingly.

displague commented 8 months ago

Is this related to needs of https://github.com/rancherlabs/harvester-equinix-terraform?

displague commented 8 months ago

A variable named equinix_metal_project_name exists and could be used. Doing so could keep the project_id variable intact and used as an alternative for the datasource (lookup by id OR name -- https://developer.hashicorp.com/terraform/language/expressions/custom-conditions#input-variable-validation).

Project names are not necessarily unique. If the user supplied a non-unique name the TF provider would throw an error, which would be the correct behavior for this scenario.

jmarhee commented 8 months ago

Got it. I didn't realize the project names themselves were not unique (and for some reason did not catch the existing variable!)-- I put this together thinking it'd be convenient so if there's that other better approach that can be worked with (as you noted), then that seems more than sufficient and we can close this out.