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

r/distributed_port_group: Use MOID as resource ID #202

Merged
merged 1 commit into from
Oct 12, 2017

Conversation

vancluever
Copy link
Contributor

The additions that are in #201 dictate the basis for how we will be
working with vSphere networks in the future - any resource that requires
a network for a backing (ie: virtual ethernet cards, VMkernel nics, etc)
will require a MOID to some sort of network, versus the name itself,
allowing us to circumvent actually searching for the network in the
downstream resource itself. Searching would be circumvented altogether
in the case of DVS portgroups being managed by TF completely as we would
just pass the MOID to the downstream resource.

The current behaviour of the vsphere_distributed_port_group resource is
to use the key attribute in the MO as the ID of the resource, which is
documented in the API as the UUID of the DVS port group, although in
reality it actually seems to be the MOID, which allows #201 to work
without issue right now. However, in order to guarantee that things will
be stable in the long run, we need to be sure we are using the right
values, so this update changes the ID to be the MOID of the object
itself. key is now being exported as a computed attribute of the same
name.

The additions that are in #201 dictate the basis for how we will be
working with vSphere networks in the future - any resource that requires
a network for a backing (ie: virtual ethernet cards, VMkernel nics, etc)
will require a MOID to some sort of network, versus the name itself,
allowing us to circumvent actually searching for the network in the
downstream resource itself. Searching would be circumvented altogether
in the case of DVS portgroups being managed by TF completely as we would
just pass the MOID to the downstream resource.

The current behaviour of the vsphere_distributed_port_group resource is
to use the key attribute in the MO as the ID of the resource, which is
documented in the API as the UUID of the DVS port group, although in
reality it actually seems to be the MOID, which allows #201 to work
without issue right now. However, in order to guarantee that things will
be stable in the long run, we need to be sure we are using the right
values, so this update changes the ID to be the MOID of the object
itself. key is now being exported as a computed attribute of the same
name.
@vancluever vancluever added the enhancement Type: Enhancement label Oct 12, 2017
Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question on dvPortgroupFromMOID but otherwise looks good

pgID := d.Id()
pg, err := dvPortgroupFromUUID(client, dvsID, pgID)
pg, err := dvPortgroupFromMOID(client, pgID)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method signature of dvPortgroupFromMOID changes here, but I don't see that in the changes here. Was it changed elsewhere, and this resource currently doesn't work without this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not just the signature, but the method as well 🙂

dvPortgroupFromUUID vs dvPortgroupFromMOID

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohisee

Copy link

@catsby catsby left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vancluever
Copy link
Contributor Author

Thanks @catsby!

@vancluever vancluever merged commit 6f8d261 into master Oct 12, 2017
@vancluever vancluever deleted the m-dvs-portgroup-use-moid branch November 22, 2017 00:09
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Type: Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants