nagaboinaramgopal opened a new pull request, #345:
URL: https://github.com/apache/cloudstack-terraform-provider/pull/345
### Description
Two problems with the `cloudstack_host` resource.
`resourceCloudStackHostUpdate` built its `UpdateHostParams` and set
`allocation_state` and `host_tags` on it, but never called `UpdateHost`, so
updating either field silently did nothing.
`host_tags` is a `schema.TypeList`, so the SDK returns `[]interface{}`, but
both create and update asserted `host_tags.([]string)`, which panics with
`interface conversion: interface {} is []interface {}, not []string` when
host_tags is set. Neither field is ForceNew, so the update path is reachable.
Fixed by calling `UpdateHost` at the end of the update, and by converting
the list to `[]string` on both the create and update paths.
### Testing
Added a unit test `TestHostCreateHostTagsDoesNotPanic` that runs the create
function with `host_tags` set against an unreachable endpoint. It needs no live
CloudStack:
go test ./cloudstack/ -run TestHostCreateHostTagsDoesNotPanic
It panics against the current code and passes with the fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]