eddycharly / terraform-provider-kops

Brings kOps into terraform in a fully managed way
Apache License 2.0
85 stars 20 forks source link

manageStorageClasses not populated when "false" and does not apply #1043

Closed r2ronoha closed 1 year ago

r2ronoha commented 1 year ago

When setting cloud_config.manage_storage_classes = false this does not populate cloudConfig.manageStorageClasses leaving it to the default value of true when the value is nil As a result, the kops default storageclass is created, creating conflicts with a custom default storageclass, preventing PVCs without explicit storage class to be created, until the kops default class is manually deleted

kuldazbraslav commented 1 year ago

I believe that this piece of code is responsible for this issue:

if reflect.DeepEqual(in, reflect.Zero(reflect.TypeOf(in)).Interface()) {
    return nil
}

The reflect.Zero basically says that if manage_storage_classes == false, it should translate to nil.

This file is generated by https://github.com/eddycharly/terraform-provider-kops/tree/main/hack/gen-tf-code but I wasn't able to find out how to tell it that the default value is true

kuldazbraslav commented 1 year ago

Further looking in the code, I believe manage_storage_classes should be a nullable argument.

Does it make sense, @eddycharly ? If so, I can prepare a PR.

eddycharly commented 1 year ago

hi @kuldazbraslav thanks for reporting, making manage_storage_classes nullable makes sense.