vatesfr / terraform-provider-xenorchestra

Xen Orchestra provider for Terraform
MIT License
150 stars 32 forks source link

Create xenorchestra_user data source #95

Closed ddelnano closed 3 years ago

ddelnano commented 3 years ago

When working with ACLs it would be helpful to be able to look up user accounts with a data source.

Once #94 is released, users will need to do the following when adding ACLs for a user account

resource "xenorchestra_acl" "acl" {
  subject = "c561e4ac-caa1-4a37-a74d-388e5bc50c52"
  object = data.xenorchestra_pool.pool.id
  action = "operator"
}

Adding a xenorchestra_user data source would allow using a user's username to more easily look up the id of a user. This would transform the code above to the following.

data "xenorchestra_user" "user" {
  username = "user"
}

resource "xenorchestra_acl" "acl" {
  subject = data.xenorchestra_user.user.id
  object = data.xenorchestra_pool.pool.id
  action = "operator"
}
ddelnano commented 3 years ago

This will be available in the next provider release (v0.10)