Skip to content
New issue

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

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

Already on GitHub? # to your account

d/datastore_cluster: New data source #437

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

vancluever
Copy link
Contributor

This is a data source counterpart to the vsphere_datastore_cluster
resource, designed to fetch the ID of a datastore cluster only as we
want to be able to provide a data source avenue for this data, to ensure
that people can use existing infrastructure that was not created in
Terraform.

This is a data source counterpart to the vsphere_datastore_cluster
resource, designed to fetch the ID of a datastore cluster only as we
want to be able to provide a data source avenue for this data, to ensure
that people can use existing infrastructure that was not created in
Terraform.
@vancluever vancluever added enhancement Type: Enhancement new-data-source Feature: New Data Source labels Mar 20, 2018
@vancluever vancluever requested a review from a team March 20, 2018 16:41
}

func dataSourceVSphereDatastoreClusterRead(d *schema.ResourceData, meta interface{}) error {
pod, err := resourceVSphereDatastoreClusterGetPodFromPath(meta, d.Get("name").(string), d.Get("datacenter_id").(string))
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like the way to reference a datastore that is in a folder would be to set name to the absolute path of the datastore. Would it work to have folder as part of the data source? That feel like it would be more intuitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, a short-form name works regardless of where the datastore cluster is in inventory. Since we use Finder to ultimately look for most objects when searching by name or path, the same rule apply. See https://godoc.org/github.com/vmware/govmomi/find and https://github.com/vmware/govmomi/blob/master/govc/README.md#usage for more details on how paths can be searched on in govmomi.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. Looks good then!

Copy link
Contributor

@bill-rich bill-rich left a comment

Choose a reason for hiding this comment

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

LGTM

@vancluever vancluever merged commit 13f737e into master Mar 20, 2018
@vancluever vancluever deleted the f-datastore-cluster-data-source branch March 31, 2018 17:41
@ghost ghost locked and limited conversation to collaborators Apr 19, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
enhancement Type: Enhancement new-data-source Feature: New Data Source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants