civo/terraform-provider-civo

`region` field in `civo_kubernetes_node_pool` should not be required

surajnarwade opened this issue · 6 comments

I think the region field in civo_kubernetes_node_pool as mentioned below should be optional:

resource "civo_kubernetes_node_pool" "back-end" {
   cluster_id = civo_kubernetes_cluster.my-cluster.id
   label = "back-end" // Optional
   node_count = 1 // Optional
   size = element(data.civo_size.xsmall.sizes, 0).name // Optional
   region = "LON1" # Currently required
}

As per the docs, the region of node_pool should match the cluster. But in cluster definition, we are already passing region and if not passed it is picking it up from the provider definition.

does this make sense? if yes, I am happy to contribute :) 🙏

Made the PR to see

Hey @alejandrojnm
I'm unable to find PR for this issue can you please link it. And if it's not been made yet i'll be happy to pick it up

I don't remember saw that PR so you can do it, let me know when is done and I will check

Hey @alejandrojnm
My approch would be:
in civo/resource_kubernetes_cluster_pool.go we need to change the region key of the schema to this

	"region": {
		Type:         schema.TypeString,
		Required:     false,
		Description:  "The region of the node pool, has to match that of the cluster. if not declare we use the region in declared in the provide",
		ValidateFunc: validation.StringIsNotEmpty,
	},

But i'm not sure what should be the value of apiClient.Region in case region is not specified and the region variable in resourceKubernetesClusterNodePoolCreate function is nil

Raised an initial PR #149 please do give it a look

For now this is not posible