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
35 stars 24 forks source link

Kubernetes Node Data Source #281

Closed benschmi closed 2 years ago

benschmi commented 2 years ago

Current Provider Version

$ terraform -v
Terraform v1.1.5
on darwin_amd64
+ provider registry.terraform.io/hashicorp/local v2.1.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/ionos-cloud/ionoscloud v6.1.3

Use-cases

I want to deploy a Postgres cluster inside the same private LAN as a K8s node pool. No other VMs should be attached to this private LAN.

At the moment this is not possible since the Postgres cluster requires the connections:cidr parameter. The CIDR cannot be fetched or computed anywhere. (A workaround is to create a native VM inside the same private LAN and use its data source to fetch the private IP of the VMs NIC. But the use case explicitly exempts the usage of another VM.)

Proposal

The Cloud API resource https://api.ionos.com/cloudapi/v6 /k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes returns the UUID of the nodes. This is the same UUID as https://api.ionos.com/cloudapi/v6 /datacenters/{datacenterId}/servers/{UUID}. From there the private IP could be fetched via a data source. However, it seems that https://api.ionos.com/cloudapi/v6 /k8s/{k8sClusterId}/nodepools/{nodepoolId}/nodes/ is not implemented in the Terraform provider. Please make is possible to fetch the UUID of K8s nodes via a data source.

cristiGuranIonos commented 2 years ago

Added ionoscloud_k8s_node_pool_nodes that lists the nodes in a nodepool. Available in 6.3.0