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

Cannot add/remove Puppet classes from hostgroup #109

Closed agriffit79 closed 1 year ago

agriffit79 commented 1 year ago

This is not working against Foreman 3.4 with the latest (0.5.7) provider.

We're setting puppet_class_ids which is being ignored.

Either there was a bug in my original code or the API has changed in more recent versions of Foreman. Will try and submit a fix.

agriffit79 commented 1 year ago

They've completely changed how the API works for Puppet in Foreman v3. You can no longer update puppet class assignments as part of the standard hostgroup or host calls, instead there are dedicated endpoints for applying classes. Not only that but there is no update functionality, only add and delete. Which makes it's difficult to implement CRUD semantics.

lhw commented 1 year ago

Maybe we need a check what version foreman is running and disable puppet classes for 3.0 and newer in that case. You can probably work around it but I have personally never worked with puppet and its not a high priority on my list.

agriffit79 commented 1 year ago

In the end I figured out a simple way to do it. I'll also add the feature request from #92. Will submit a PR in a day or so.