hashicorp / terraform-provider-vsphere

Terraform Provider for VMware vSphere
https://registry.terraform.io/providers/hashicorp/vsphere/
Mozilla Public License 2.0
612 stars 449 forks source link

Add support for adding vms into an existing vm group #1999

Open gustavopjardim opened 1 year ago

gustavopjardim commented 1 year ago

Community Guidelines

Description

The current plugin has a resource called vsphere_compute_cluster_vm_group, which creates vm groups and also controls the members. However, in some cases, we have to reuse some existent group, and just include a few more members without changing what is already present in the group.

This enhancement proposes a new resource that could be called "vsphere_compute_cluster_vm_group_add_member", which would receive the vsphere_compute_cluster_vm_group id, as well as the new member id, and it would include the new member in the vm group.

Use Case(s)

Reusing vm groups that are already present in vsphere and are not (or can not be) managed by terraform.

Potential Terraform Provider Configuration

resource "vsphere_compute_cluster_vm_group_add_member" "new_member" { vm_group_id = "${vsphere_compute_cluster_vm_group.vm_group.id}" virtual_machine_id = "${vsphere_virtual_machine.vm.id}" }

References

No response

github-actions[bot] commented 1 year ago

Hello, gustavopjardim! 🖐

Thank you for submitting an issue for this provider. The issue will now enter into the issue lifecycle.

If you want to contribute to this project, please review the contributing guidelines and information on submitting pull requests.

tenthirtyam commented 1 year ago

Is there a reason that an import of the resource would not work?

gustavopjardim commented 1 year ago

The import option assumes that this group is managed by terraform in this workspace, but this group has hundreds of vms that are not managed by terraform. The group is not exclusive for the set of servers created by terraform in this workspace.

If I import this group to terraform, I need to have a list of all VM ids members of this group to maintain the group updated by terraform. Otherwise, terraform will update the group removing all the vms already present to it.

If I have a static list for all members in this group, it would be deprecated soon because I have other automations including servers into this group.

The idea is to have something similar to the aws_security_group and aws_security_group_rule, in one we create the group, and in another we add the members (rules in this case).

nikee73 commented 7 months ago

Any update on this?