terraform-provider-vsphere icon indicating copy to clipboard operation
terraform-provider-vsphere copied to clipboard

Add support for adding vms into an existing vm group

Open gustavopjardim opened this issue 1 year ago • 4 comments

Community Guidelines

  • [X] I have read and agree to the HashiCorp Community Guidelines .
  • [X] Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
  • [X] Do not leave "+1" or other comments that do not add relevant information or questions.
  • [ ] If you are interested in working on this issue or have submitted a pull request, please leave a comment.

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

gustavopjardim avatar Aug 21 '23 18:08 gustavopjardim

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.

github-actions[bot] avatar Aug 21 '23 18:08 github-actions[bot]

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

tenthirtyam avatar Aug 21 '23 20:08 tenthirtyam

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).

gustavopjardim avatar Aug 22 '23 14:08 gustavopjardim

Any update on this?

nikee73 avatar Feb 07 '24 13:02 nikee73