ionos-cloud / terraform-provider-ionoscloud

The IonosCloud Terraform provider gives the ability to deploy and configure resources using the IonosCloud APIs.
Mozilla Public License 2.0
34 stars 23 forks source link

ionoscloud_dataplatform_cluster does not create the cluster with the correct name #484

Open FLST-btelligent opened 10 months ago

FLST-btelligent commented 10 months ago

Description

I create the IONOS Cloud Dataplatform Cluster with the resource "ionoscloud_dataplatform_cluster" but it does not create the cluster with the correct name within the IONOS Cloud. The Cluster has the ID as name and not the one I configured within the resource.

When I create a managed k8s cluster with the resource "ionoscloud_k8s_cluster" it works as expected and the cluster gets created with the correct name.

Screenshot 2023-11-06 at 09 11 16

This issue does lead to other issues why working with the "ionoscloud_dataplatform_cluster" datasource. Where we have the issue, that we cannot find the data platform cluster by name and neither by ID:

Screenshot_2023-10-18_113228

Expected behavior

I expect that the cluster gets created with the name configured within the Terraform resource and that I also can get the cluster via the datasource by the name of the cluster.

Environment

Terraform version:

1.6.3

Provider version:

6.4.9

OS:

linux

How to Reproduce

Steps to reproduce the behavior:

  1. create the Terraform resource "ionoscloud_dataplatform_cluster" and configure a name
  2. Do a Terraform apply and deploy the cluster to the IONOS Cloud
  3. Review the Cluster Name within the Cloud, or use the Data source and try to get the cluster by name.
cristiGuranIonos commented 10 months ago

Hi, the DCD output is confusing and seems to have a bug.

What happens if you use this for data source?

terraform { required_providers { ionoscloud = { source = "ionos-cloud/ionoscloud" version = ">= 6.4.10" } } } resource "ionoscloud_datacenter" "example" { name = "Datacenter_Example" location = "de/txl" description = "Datacenter for testing Dataplatform Cluster" }

resource "ionoscloud_dataplatform_cluster" "example" { datacenter_id = ionoscloud_datacenter.example.id name = "Dataplatform_Cluster_Example" maintenance_window { day_of_the_week = "Sunday" time = "09:00:00" } version = "23.7" }

data "ionoscloud_dataplatform_cluster" "example" { name = resource.ionoscloud_dataplatform_cluster.example.name }

I've provided the entire plan, but please adjust according to your plan/names

FLST-btelligent commented 10 months ago

Thanks for your quick answer!

The Plan gives me then the ID as return value, what is within the IONOS Portal my cluster name.

What I actually would like to get in the end, was the UUID from the Cluster, to use this with the datasource "ionoscloud_k8s_node_pool_nodes" but that is actually not possible because there I get the error that it can not find a cluster with the provided UUID - What makes totally sense, because the returned value is not an UUID.

But then the question, how can I get the nodes from the dataplatform Cluster, to then taint them for example?

cristiGuranIonos commented 10 months ago

Ah, I see. Manually, you can go to DCD and then go to the Kubernetes Manager and there you can see the API in blue next to your cluster. Click there and you will get a href where you can see the k8s details. To see nodepools, add depth=3 at the end of the url : https://api.ionos.com/cloudapi/v6/k8s/cluster_id_here?depth=3 Will investigate on how to get it from terraform.

You can use this datasource and see the dataplatform k8s cluster as a server, but not sure if this is useful: data ionoscloud_servers example { datacenter_id = ionoscloud_datacenter.example.id filter { name = "name" value = "name_from_dcd_here" } }

FLST-btelligent commented 10 months ago

Thank you! I am looking forward to your answer on how to get it from terraform :)

cristiGuranIonos commented 10 months ago

Currently no way from terraform, but I think you can use ionoctl and then set the ids in variables that can used in terraform? ionosctl k8s cluster list --filters name= ionosctl k8s nodepool list --cluster-id=

We will try to add a way to see this from terraform data source directly.