squat / terraform-provider-vultr

Terraform Vultr Provider
Mozilla Public License 2.0
167 stars 22 forks source link

FillMap keys processing which have ',string' #81

Closed yeongjukang closed 5 years ago

yeongjukang commented 5 years ago

Hi, thank you for providing such a good plugin. When I executed 'terraform plan' using below, I met no-result error. data "vultr_plan" "cheapest" { filter { name = "price_per_month" values = ["5.00"] } filter { name = "ram" values = ["1024"] } filter { name = "vcpu_count" values = ["1"] } }

I detected type conversion problem at FillMap method in fatih/struct/structs.go at vendor.

This is old source debugging. [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:09:59 name: VPSPLANID [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:09:59 s : [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:09:59 name: vcpu_count [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:09:59 s :

And new one. [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:32:29 name: VPSPLANID [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:32:29 s : 201 [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:32:29 name: vcpu_count [DEBUG] plugin.terraform-provider-vultr: 2019/06/16 22:32:29 s : 1

Other fields defined as plain integer type in 'Server' struct in vendor/JamesClonk/vultr/lib/servers.go also had same problem because of this. Fatih's struct repository is archived, so I directly modified here.

yeongjukang commented 5 years ago

I also made a fork of fatih's 'struct' and updated this method in case you want to change glide.yaml. Thank you again for such a good library

squat commented 5 years ago

@979156 thanks a lot for finding this. Unfortunately, we can't really keep a patch inside of the vendor directory, that dir is meant to be generated at any time, and the patch would be overwritten. We may have to instead internalize the one function we need from that library.

yeongjukang commented 5 years ago

I will make lib/struct internally following your guide. Thanks.