hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.64k forks source link

Support for desktopvirtualization.sessionHosts - resource `virtual_desktop_session_host ` #15563

Closed hayorov closed 7 months ago

hayorov commented 2 years ago

Community Note

Description

Support functionality desktopvirtualization.sessionHosts https://docs.microsoft.com/en-us/rest/api/desktopvirtualization/session-hosts/

New or Affected Resource(s)

Potential Terraform Configuration

N/a

References

sinbai commented 2 years ago

@hayorov thank you for opening this issue. First, I would like to clarify that a valid Terraform candidate should have API to support the resource CRUD: any of the Create/Read/Delete could not be missed. After checking, there is no create API available for session host. Hence, sorry to say that terraform could not support the virtual_desktop_session_host resource.

hayorov commented 2 years ago

Many thanks, @sinbai , it totally makes sense why this resource cannot be presented as a resource (lack of creating operation), and based on my humble research thesis is no direct way to create (add) session. It seems that creation happens indirectly after VM Azure VD agent installation with a unique node pool token (automatically via Azure VD control plane - VM extension or manual agent .EXE setup).

Is that possible to consider a data resource for sessionhost and dedicated resources for some critical operations like User assigned to SessionHost? (properties.assignedUser) ref https://docs.microsoft.com/en-us/rest/api/desktopvirtualization/session-hosts/update

I'd like to volunteer and support it but before, please let me know if that is conceptually acceptable?

Extra

sinbai commented 2 years ago

@hayorov As far as I know, data resources in terraform are only used to read objects. so the Session Hosts - Update could not be supported as a data resource. See the description below for details, ref to https://www.terraform.io/language/data-sources#using-data-sources

When distinguishing from data resources, the primary kind of resource (as declared by a resource block) is known as a managed resource. Both kinds of resources take arguments and export attributes for use in configuration, but while managed resources cause Terraform to create, update, and delete infrastructure objects, data resources cause Terraform only to read objects. For brevity, managed resources are often referred to just as "resources" when the meaning is clear from context.

sinbai commented 2 years ago

@hayorov based on the above context, are you okey if we close this issue?

hayorov commented 2 years ago

@sinbai I mean expose sesson_host as a data source resource and some operations from session_host like user assignment (it's possible to simulate CRUD-like operations).

Anyways, it's ok to close the issue.

rcskosir commented 7 months ago

Closing per the author above.

github-actions[bot] commented 6 months ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.