Open jtackaberry opened 1 year ago
@jtackaberry Thanks for the issue. I'll spend some time testing this out and see what we can do.
I think I just ran into this issue. First, I tried the obvious thing:
terraform import vultr_kuberenets.my_cluster <uuid copied from browser URL>
This was successful, but then after I ran terraform plan
, it started complaining that the cluster must be replaced. Upon further inspection, I found out that some fields in the state file were null, even though they should have values. In my case, those were:
region
label
enable_firewall
There might be others as well. I tried digging around in the source code, and found this: https://github.com/vultr/terraform-provider-vultr/blob/master/vultr/resource_vultr_kubernetes.go#L155 . I'm not familiar with the Terraform Provider SDK, but it seems to me that resourceVultrKubernetesRead
is not reading all fields, which leads to terraform import
saving null values. @optik-aper If my train of thought is correct, let me know and I'll push a PR to deal with the 3 fields above!
FYI, I solved my problem by manually editing the state file and setting the fields as needed. But obviously this is a dirty hack, so think thrice before trying it.
Currently existing VKE clusters and node pools can't be imported into state. This feature request is just to provide some means of importing these existing resources.