I recently started using your terraform provider for my homelab, but seem to have encountered a problem there.
I already messaged about it on the discord server & created this issue accordingly.
What I wanted to realize
My primary goal was to provision my VMs through terraform, but not giving XO-admin rights to my terraform-user at the same time, as the XCP-NG host also contains other VMs which shouldn't be managed by terraform yet. (simply because I originally was doing a tutorial)
I tried to realize this by using the Self Service in XO & constrained my terraform user to only a resourceSet.
Description / Problem
While doing so I discovered a problem with the parameters, that the UpdateVm(..) function gives to the vm.set call. It seems, that whenever the XO-API receives a parameter for the resourceSet it checks if the user also is an XO-admin and throws an exception otherwise. [Source]
This made me play around with the XO-CLI a bit and, at least I think, the intended usage of the vm.set endpoint is to only add the parameters that need to be changed, which should probably also be the only ones (beside the id), that were listed by terraform in the apply/plan.
Possible Solution
Filter the parameters before adding them to the vm.set call
Reproduction
XO
Preparation
create a demo user in XO with only User rights
assign the user to a group(e.g. terraform) in XO
create a resourceSet/self-service (e.g. test) with access to all resources and is managed by your group
doesn't need to be all, but helps demonstrate, that it's not a permission issue with any single resource
Note: for Networks I only selected Pool-wide network, as anything else caused my host to be listed as excluded
no ACLs are required
Verification:
login with your demo user to XO
create, update & delete a VM through the web-UI to check your account permissions are correct
Hi there,
I recently started using your terraform provider for my homelab, but seem to have encountered a problem there. I already messaged about it on the discord server & created this issue accordingly.
What I wanted to realize
My primary goal was to provision my VMs through terraform, but not giving XO-admin rights to my terraform-user at the same time, as the XCP-NG host also contains other VMs which shouldn't be managed by terraform yet. (simply because I originally was doing a tutorial)
I tried to realize this by using the
Self Service
in XO & constrained my terraform user to only aresourceSet
.Description / Problem
While doing so I discovered a problem with the parameters, that the
UpdateVm(..)
function gives to thevm.set
call. It seems, that whenever the XO-API receives a parameter for theresourceSet
it checks if the user also is an XO-admin and throws an exception otherwise. [Source]This made me play around with the XO-CLI a bit and, at least I think, the intended usage of the
vm.set
endpoint is to only add the parameters that need to be changed, which should probably also be the only ones (beside theid
), that were listed by terraform in the apply/plan.Possible Solution
Filter the parameters before adding them to the
vm.set
callReproduction
XO
Preparation
demo
user in XO with onlyUser
rightsPool-wide network
, as anything else caused my host to be listed as excludedVerification:
demo
user to XOTerraform / CLI
name_label
to something elseResult
You are most likely to receive a permission problem in your CLI now:
Also in XenOrchestra, you should see an entry to your
Settings->Logs
sayingnot enough permission
with the following information:EDIT: typos & fixed XO source link