{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/go-discover/pulls/comments/192875460","pull_request_review_id":125736736,"id":192875460,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5Mjg3NTQ2MA==","diff_hunk":"@@ -0,0 +1,417 @@\n+// Package vsphere provides node discovery for VMware vSphere.\n+//\n+// The package performs discovery by searching vCenter for all nodes matching a\n+// certain tag, it then discovers all known IP addresses through VMware tools\n+// that are not loopback or auto-configuration addresses.\n+//\n+// This package requires at least vSphere 6.0 in order to function.\n+package vsphere\n+\n+import (\n+\t\"context\"\n+\t\"fmt\"\n+\t\"io/ioutil\"\n+\t\"log\"\n+\t\"net\"\n+\t\"net/url\"\n+\t\"os\"\n+\t\"strconv\"\n+\t\"strings\"\n+\t\"time\"\n+\n+\t\"github.com/vmware/govmomi\"\n+\t\"github.com/vmware/govmomi/find\"\n+\t\"github.com/vmware/govmomi/object\"\n+\t\"github.com/vmware/govmomi/vim25/mo\"\n+\t\"github.com/vmware/govmomi/vim25/types\"\n+\t\"github.com/vmware/vic/pkg/vsphere/tags\"\n+)\n+\n+// providerLog is the local provider logger. This should be initialized from\n+// the provider entry point.\n+var logger *log.Logger\n+\n+// setLog sets the logger.\n+func setLog(l *log.Logger) {\n+\tif l != nil {\n+\t\tlogger = l\n+\t} else {\n+\t\tlogger = log.New(ioutil.Discard, \"\", 0)\n+\t}\n+}\n+\n+// discoverErr prints out a friendly error heading for the top-level discovery\n+// errors. It should only be used in the Addrs method.\n+func discoverErr(format string, a ...interface{}) error {\n+\tvar s string\n+\tif len(a) > 1 {\n+\t\ts = fmt.Sprintf(format, a)\n+\t} else {\n+\t\ts = format\n+\t}\n+\treturn fmt.Errorf(\"discover-vsphere: %s\", s)\n+}\n+\n+// valueOrEnv provides a way of suppling configuration values through\n+// environment variables. Defined values always take priority.\n+func valueOrEnv(config map[string]string, key, env string) string {","path":"provider/vsphere/vsphere_discover.go","position":57,"original_position":57,"commit_id":"99de6b63315fd4d5b1a2ecac62d4a3eaa73ea908","original_commit_id":"99de6b63315fd4d5b1a2ecac62d4a3eaa73ea908","user":{"login":"vancluever","id":10704423,"node_id":"MDQ6VXNlcjEwNzA0NDIz","avatar_url":"https://avatars0.githubusercontent.com/u/10704423?v=4","gravatar_id":"","url":"https://api.github.com/users/vancluever","html_url":"https://github.com/vancluever","followers_url":"https://api.github.com/users/vancluever/followers","following_url":"https://api.github.com/users/vancluever/following{/other_user}","gists_url":"https://api.github.com/users/vancluever/gists{/gist_id}","starred_url":"https://api.github.com/users/vancluever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vancluever/subscriptions","organizations_url":"https://api.github.com/users/vancluever/orgs","repos_url":"https://api.github.com/users/vancluever/repos","events_url":"https://api.github.com/users/vancluever/events{/privacy}","received_events_url":"https://api.github.com/users/vancluever/received_events","type":"User","site_admin":false},"body":"Yeah, the SDK doesn't really give you anything to work with in this regard. I figured I'd as as much as possible to provide options, but we can get rid of the non-connectivity related ones if you want (`VSPHERE_TAG_NAME`, `VSPHERE_TAG_NAME`, `VSPHERE_TIMEOUT`), if you'd rather people be explicit with those options at least.","created_at":"2018-06-04T20:48:06Z","updated_at":"2018-06-04T20:48:06Z","html_url":"https://github.com/hashicorp/go-discover/pull/43#discussion_r192875460","pull_request_url":"https://api.github.com/repos/hashicorp/go-discover/pulls/43","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/comments/192875460"},"html":{"href":"https://github.com/hashicorp/go-discover/pull/43#discussion_r192875460"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/43"}},"in_reply_to_id":192839004},"pull_request":{"url":"https://api.github.com/repos/hashicorp/go-discover/pulls/43","id":192205221,"node_id":"MDExOlB1bGxSZXF1ZXN0MTkyMjA1MjIx","html_url":"https://github.com/hashicorp/go-discover/pull/43","diff_url":"https://github.com/hashicorp/go-discover/pull/43.diff","patch_url":"https://github.com/hashicorp/go-discover/pull/43.patch","issue_url":"https://api.github.com/repos/hashicorp/go-discover/issues/43","number":43,"state":"open","locked":false,"title":"Add vSphere discovery","user":{"login":"vancluever","id":10704423,"node_id":"MDQ6VXNlcjEwNzA0NDIz","avatar_url":"https://avatars0.githubusercontent.com/u/10704423?v=4","gravatar_id":"","url":"https://api.github.com/users/vancluever","html_url":"https://github.com/vancluever","followers_url":"https://api.github.com/users/vancluever/followers","following_url":"https://api.github.com/users/vancluever/following{/other_user}","gists_url":"https://api.github.com/users/vancluever/gists{/gist_id}","starred_url":"https://api.github.com/users/vancluever/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vancluever/subscriptions","organizations_url":"https://api.github.com/users/vancluever/orgs","repos_url":"https://api.github.com/users/vancluever/repos","events_url":"https://api.github.com/users/vancluever/events{/privacy}","received_events_url":"https://api.github.com/users/vancluever/received_events","type":"User","site_admin":false},"body":"This is a new discovery provider for VMware vSphere, working off its tagging capability.\r\n\r\nThis is to help facilitate some work I'm doing for Consul - currently vSphere lacks the ability to do auto-join, which is making discovery hard, which unfortunately makes writing TF scenarios for Consul deployment that resemble our other major cloud deployment paths even harder. Having vSphere discovery will solve that problem.\r\n\r\nI think it goes without saying, but as this requires that a password be stored somewhere within the clear at least somewhere (at the very least on the server itself in an env var), any user that is used with VMware discovery should have reduced privileges, at the very least assigned the built-in read-only role (plus any privileges needed to access the REST API in a read-only capacity), at best given the minimal set of read-only privileges.","created_at":"2018-06-02T16:14:09Z","updated_at":"2018-06-04T20:48:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3e0c720b7cd65a9f7a885aa9a980d07fdf3b82b3","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/go-discover/pulls/43/commits","review_comments_url":"https://api.github.com/repos/hashicorp/go-discover/pulls/43/comments","review_comment_url":"https://api.github.com/repos/hashicorp/go-discover/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/go-discover/issues/43/comments","statuses_url":"https://api.github.com/repos/hashicorp/go-discover/statuses/99de6b63315fd4d5b1a2ecac62d4a3eaa73ea908","head":{"label":"hashicorp:f-vsphere-discovery","ref":"f-vsphere-discovery","sha":"99de6b63315fd4d5b1a2ecac62d4a3eaa73ea908","user":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":94883751,"node_id":"MDEwOlJlcG9zaXRvcnk5NDg4Mzc1MQ==","name":"go-discover","full_name":"hashicorp/go-discover","owner":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/go-discover","description":"Discover nodes in cloud environments","fork":false,"url":"https://api.github.com/repos/hashicorp/go-discover","forks_url":"https://api.github.com/repos/hashicorp/go-discover/forks","keys_url":"https://api.github.com/repos/hashicorp/go-discover/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/go-discover/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/go-discover/teams","hooks_url":"https://api.github.com/repos/hashicorp/go-discover/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/go-discover/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/go-discover/events","assignees_url":"https://api.github.com/repos/hashicorp/go-discover/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/go-discover/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/go-discover/tags","blobs_url":"https://api.github.com/repos/hashicorp/go-discover/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/go-discover/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/go-discover/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/go-discover/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/go-discover/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/go-discover/languages","stargazers_url":"https://api.github.com/repos/hashicorp/go-discover/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/go-discover/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/go-discover/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/go-discover/subscription","commits_url":"https://api.github.com/repos/hashicorp/go-discover/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/go-discover/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/go-discover/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/go-discover/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/go-discover/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/go-discover/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/go-discover/merges","archive_url":"https://api.github.com/repos/hashicorp/go-discover/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/go-discover/downloads","issues_url":"https://api.github.com/repos/hashicorp/go-discover/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/go-discover/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/go-discover/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/go-discover/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/go-discover/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/go-discover/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/go-discover/deployments","created_at":"2017-06-20T11:25:41Z","updated_at":"2018-06-04T03:39:23Z","pushed_at":"2018-06-03T05:03:28Z","git_url":"git://github.com/hashicorp/go-discover.git","ssh_url":"git@github.com:hashicorp/go-discover.git","clone_url":"https://github.com/hashicorp/go-discover.git","svn_url":"https://github.com/hashicorp/go-discover","homepage":"","size":3894,"stargazers_count":107,"watchers_count":107,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":28,"open_issues":9,"watchers":107,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"f813bf45d00135c1a039e028fec38b7cc387ddbc","user":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"repo":{"id":94883751,"node_id":"MDEwOlJlcG9zaXRvcnk5NDg4Mzc1MQ==","name":"go-discover","full_name":"hashicorp/go-discover","owner":{"login":"hashicorp","id":761456,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MTQ1Ng==","avatar_url":"https://avatars2.githubusercontent.com/u/761456?v=4","gravatar_id":"","url":"https://api.github.com/users/hashicorp","html_url":"https://github.com/hashicorp","followers_url":"https://api.github.com/users/hashicorp/followers","following_url":"https://api.github.com/users/hashicorp/following{/other_user}","gists_url":"https://api.github.com/users/hashicorp/gists{/gist_id}","starred_url":"https://api.github.com/users/hashicorp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashicorp/subscriptions","organizations_url":"https://api.github.com/users/hashicorp/orgs","repos_url":"https://api.github.com/users/hashicorp/repos","events_url":"https://api.github.com/users/hashicorp/events{/privacy}","received_events_url":"https://api.github.com/users/hashicorp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hashicorp/go-discover","description":"Discover nodes in cloud environments","fork":false,"url":"https://api.github.com/repos/hashicorp/go-discover","forks_url":"https://api.github.com/repos/hashicorp/go-discover/forks","keys_url":"https://api.github.com/repos/hashicorp/go-discover/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/go-discover/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/go-discover/teams","hooks_url":"https://api.github.com/repos/hashicorp/go-discover/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/go-discover/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/go-discover/events","assignees_url":"https://api.github.com/repos/hashicorp/go-discover/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/go-discover/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/go-discover/tags","blobs_url":"https://api.github.com/repos/hashicorp/go-discover/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/go-discover/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/go-discover/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/go-discover/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/go-discover/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/go-discover/languages","stargazers_url":"https://api.github.com/repos/hashicorp/go-discover/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/go-discover/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/go-discover/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/go-discover/subscription","commits_url":"https://api.github.com/repos/hashicorp/go-discover/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/go-discover/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/go-discover/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/go-discover/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/go-discover/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/go-discover/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/go-discover/merges","archive_url":"https://api.github.com/repos/hashicorp/go-discover/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/go-discover/downloads","issues_url":"https://api.github.com/repos/hashicorp/go-discover/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/go-discover/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/go-discover/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/go-discover/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/go-discover/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/go-discover/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/go-discover/deployments","created_at":"2017-06-20T11:25:41Z","updated_at":"2018-06-04T03:39:23Z","pushed_at":"2018-06-03T05:03:28Z","git_url":"git://github.com/hashicorp/go-discover.git","ssh_url":"git@github.com:hashicorp/go-discover.git","clone_url":"https://github.com/hashicorp/go-discover.git","svn_url":"https://github.com/hashicorp/go-discover","homepage":"","size":3894,"stargazers_count":107,"watchers_count":107,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mpl-2.0","name":"Mozilla Public License 2.0","spdx_id":"MPL-2.0","url":"https://api.github.com/licenses/mpl-2.0","node_id":"MDc6TGljZW5zZTE0"},"forks":28,"open_issues":9,"watchers":107,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/43"},"html":{"href":"https://github.com/hashicorp/go-discover/pull/43"},"issue":{"href":"https://api.github.com/repos/hashicorp/go-discover/issues/43"},"comments":{"href":"https://api.github.com/repos/hashicorp/go-discover/issues/43/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/43/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/go-discover/pulls/43/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/go-discover/statuses/99de6b63315fd4d5b1a2ecac62d4a3eaa73ea908"}},"author_association":"NONE"}}
{"actor":{"display_login":"vancluever"}}