terraform-coop / terraform-provider-foreman

Terraform provider for Foreman
https://registry.terraform.io/providers/terraform-coop/foreman
Mozilla Public License 2.0
33 stars 31 forks source link

TypeMap schemas now require Elem of TypeString #73

Closed lhw closed 2 years ago

MrFreezeex commented 2 years ago

Just checked and parameters in the host resrouce need to be TypeMap instead of TypeList. I will check if this also applies to some other arguments as well...

EDIT: I think that's the only argument that needs that but I may be wrong...

lhw commented 2 years ago

Just checked and parameters in the host resrouce need to be TypeMap instead of TypeList. I will check if this also applies to some other arguments as well...

EDIT: I think that's the only argument that needs that but I may be wrong...

I think you are right. And from what I see its already handled everywhere as if it were TypeMap. I'll just add the fix here.

MrFreezeex commented 2 years ago

Oh and also... I just tested and it can't be casted directly to map[string]string here https://github.com/HanseMerkur/terraform-provider-foreman/blob/master/foreman/resource_foreman_host.go#L485:

Stack trace from the terraform-provider-foreman plugin:

panic: interface conversion: interface {} is map[string]interface {}, not map[string]string

goroutine 37 [running]:
github.com/HanseMerkur/terraform-provider-foreman/foreman.buildForemanHost(0xc000486150)
    /afs/cern.ch/user/a/aoutheni/terraform-provider-foreman/foreman/resource_foreman_host.go:491 +0x867
[...]

The openstack provider use this function to sort that out: https://github.com/terraform-provider-openstack/terraform-provider-openstack/blob/main/openstack/util.go#L159 :cry:...

lhw commented 2 years ago

So basically the same as I had before. I think I just forgot about it after a year. Well no use lamenting the annoyance. I'll just fix that as well.

MrFreezeex commented 2 years ago

Hmmm while checking if updating parameters works I had some weird errors... That's probably related to my setup (managed/build=false + puppet that update stuff on foreman)... Probably not related to this, will dig into it and probably find a fix for that tomorrow!