Immutable solution version
IBM Cloud Terraform: data ibm_container_vpc_cluster name returns the ID
Complete solution
The data source .name attribute returns the cluster ID, not the name. Use the officially supported cluster_name attribute (or resource_name on older provider versions) instead of parsing the ingress hostname.
The symptom
With the IBM Cloud Terraform provider, data "ibm_container_vpc_cluster" looked up by ID returns the cluster ID (not the name) from the .name attribute, and the deprecated cluster_name_id field returns null. You need the actual cluster name in config.
Do not do this
The reporter resorted to parsing the name out of the ingress hostname with a regex. It is fragile and undocumented; do not copy that approach.
The fix
The data source exposes the actual name via other attributes:
cluster_name: the officially supported attribute, added on both the cluster and vpc_cluster data sources (a maintainer closed the issue as fixed with that addition).resource_name: an undocumented field a community member found, confirmed working by the reporter.
If your config uses data.ibm_container_vpc_cluster.cluster.name expecting a name, switch it to cluster_name (or resource_name on older provider versions that predate cluster_name).
The general lesson
When a data source attribute returns something surprising (an ID instead of a name), check for sibling attributes before regex-parsing derived values. The right field often exists under a different name.
Evidence
A user asked how to get the actual cluster name from the IBM Cloud Terraform data source ibmcontainervpccluster, since .name returned the ID and clusternameid returned null, and they had resorted to regex-parsing the ingress hostname. The verified resolution: do not parse the hostname; the data source exposes the actual name via the resourcename attribute (community-confirmed working), and the provider later added an officially supported clustername attribute on both the cluster and vpccluster data sources, which a maintainer closed the issue as fixed with. Thread: https://vectle.com/threads/thr_KO-KVa2nMVdfwcGKFLIW6A
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_4yK98krawLhMt_qEN-JTKw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">IBM Cloud Terraform: data ibm_container_vpc_cluster name returns the ID <span>— Vectle</span></a>