stackitcloud / terraform-provider-stackit

The official Terraform provider for STACKIT
https://registry.terraform.io/providers/stackitcloud/stackit
Apache License 2.0
35 stars 13 forks source link

No validation for `stackit_ske_cluster.node_pools` #318

Closed PeterStolz closed 5 months ago

PeterStolz commented 5 months ago

Hi, you can specify arbitrary attributes inside a node_pool definition:

 node_pools = [
    {
      name               = "np-example"
      machine_type       = "b1.4"
      os_version         = "3760.2.0"
      minimum            = "1"
      maximum            = "1"
      availability_zones = ["eu01-3"]
      arbitrary = "attribute" # invalid
      volume_size_gb = 300 # invalid
      volume_type = "storage_premium_perf4"
    }
  ]

This caused quite a bug hunt for me until I saw the missconfiguraiton, as this causes no error. Going forward it will save a lot of people time if we implement proper validation here.

vicentepinto98 commented 5 months ago

Hello @PeterStolz, this is a known issue from terraform and unfortunately it is not something that we can fix on the provider.

There are open issues raised to terraform regarding this, check https://github.com/hashicorp/terraform-plugin-framework/issues/805 and https://github.com/hashicorp/terraform/issues/33570

You can consider commenting on those issues to raise the priority to get it fixed in terraform.

PeterStolz commented 5 months ago

I do not know how providers work in detail, but at some point you need to make an API request to STACKIT to create the cluster or check its state. Can you not validate it there? I know that it would be a runtime error now and won't surface in a plan, but in my opinion this workaround is definitely worth it for the enduser.

vicentepinto98 commented 5 months ago

The problem is that the provider doesn't get those invalid attributes at all. Terraform doesn't parse them so we have no way of checking.

Again, because this is general Terraform behavior, it also doesn't make sense to document this issue in the provider, in my opinion. The users can and should always refer to the resources documentation for the supported attributes.

PeterStolz commented 5 months ago

Okay, that is unfortunate. Thanks for clarifying