Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nsxt_ns_group to support VMnames #701

Open
DravenChikken opened this issue Dec 20, 2021 · 2 comments
Open

nsxt_ns_group to support VMnames #701

DravenChikken opened this issue Dec 20, 2021 · 2 comments

Comments

@DravenChikken
Copy link

Is your feature request related to a problem? Please describe.

creating groups to add Virtual Machine names directly. When importing a exiting group with VMs already existing, the import looks as follows with the VirtualMachine names -

`
resource "nsxt_ns_group" "nsxt_ns_group" {
display_name = "default.test"
id = "13589a4b-9d26-49cc-87b0-3e71b4812eb6"
revision = 0

member {
    target_type = "VirtualMachine"
    value       = "500848a3-d42e-f111-55c9-e487097e2821"
}
member {
    target_type = "VirtualMachine"
    value       = "50085f4d-9424-c8e4-a063-683855700047"
}
member {
    target_type = "VirtualMachine"
    value       = "50087c2b-66d8-e5b8-6992-d07a6aa57788"
}
member {
    target_type = "VirtualMachine"
    value       = "5008975a-67cc-511e-a431-c0fae2afff4c"
}
member {
    target_type = "VirtualMachine"
    value       = "5008acd7-14b7-51a6-374c-d8115182b4c2"
}
member {
    target_type = "VirtualMachine"
    value       = "5008b3bb-930a-3943-1e95-c6002de2be43"
}

tag {
    scope = "policyPath"
    tag   = "/infra/domains/default/groups/test"
}

}

Describe the solution you'd like

The target_type VirtualMachine is not supported. Additional enchancement would be to use the VirutalMachine Name. So a easier variable would be used rather the ID of the VirtualMachine. So the resource/variable would look like -

`
resource "nsxt_ns_group" "nsxt_ns_group" {
for_each = var.nsxt_ns_group
description = each.value.description
display_name = each.key
dynamic "member" {
for_each = each.value
content {
target_type = "VirutalMachine"
value = member.value
}
}
}

variable -

variable "nsxt_ns_group" {
type = map
default = {
test_server_ns_group = ["test1.test.local","test2.test.local","test3.test.local"]
}
}
`

Otherwise the variable would either look like the below or a data reference

variable "nsxt_ns_group" { type = map default = { test_server_ns_group = ["500848a3-d42e-f111-55c9-e487097e2821","50085f4d-9424-c8e4-a063-683855700047","50087c2b-66d8-e5b8-6992-d07a6aa57788"] } }

`

Describe alternatives you've considered

No response

Additional context

No response

@github-actions
Copy link

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale label Dec 15, 2022
@annakhm annakhm reopened this Apr 3, 2023
@annakhm annakhm removed the stale label Apr 3, 2023
@annakhm
Copy link
Collaborator

annakhm commented Apr 3, 2023

Hello, sorry it took us long to respond to this issue, could you please help clarify it?
The issue says The target_type VirtualMachine is not supported
However group resource offers member_type = VirtualMachine, does it solve the issue?

Regarding VM names - would it help to use nsxt_policy_vms data source it order to retrieve VM id by name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants