{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/60837056","id":60837056,"diff_hunk":"@@ -0,0 +1,213 @@\n+package vsphere\n+\n+import (\n+\t\"fmt\"\n+\t\"log\"\n+\n+\t\"github.com/hashicorp/terraform/helper/schema\"\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/types\"\n+\t\"golang.org/x/net/context\"\n+)\n+\n+type virtualDisk struct {\n+\tsize       int\n+\tvmdkPath   string\n+\tinitType   string\n+\tdatacenter string\n+\tdatastore  string\n+}\n+\n+func resourceVSphereVirtualDisk() *schema.Resource {\n+\treturn &schema.Resource{\n+\t\tCreate: resourceVSphereVirtualDiskCreate,\n+\t\tRead:   resourceVSphereVirtualDiskRead,\n+\t\tDelete: resourceVSphereVirtualDiskDelete,\n+\n+\t\tSchema: map[string]*schema.Schema{\n+\t\t\t// Size in GB\n+\t\t\t\"size\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeInt,\n+\t\t\t\tRequired: true,\n+\t\t\t\tForceNew: true, //TODO Can this be optional (resize)?\n+\t\t\t},\n+\n+\t\t\t\"vmdk_path\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tRequired: true,\n+\t\t\t\tForceNew: true, //TODO Can this be optional (move)?\n+\t\t\t},\n+\n+\t\t\t\"type\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tOptional: true,\n+\t\t\t\tForceNew: true,\n+\t\t\t\tDefault:  \"eagerZeroedThick\",\n+\t\t\t\tValidateFunc: func(v interface{}, k string) (ws []string, errors []error) {\n+\t\t\t\t\tvalue := v.(string)\n+\t\t\t\t\tif value != \"thin\" && value != \"eagerZeroedThick\" {\n+\t\t\t\t\t\terrors = append(errors, fmt.Errorf(\n+\t\t\t\t\t\t\t\"only 'thin' and 'eagerZeroedThick' are supported values for 'type'\"))\n+\t\t\t\t\t}\n+\t\t\t\t\treturn\n+\t\t\t\t},\n+\t\t\t},\n+\n+\t\t\t\"datacenter\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tOptional: true,\n+\t\t\t\tForceNew: true,\n+\t\t\t},\n+\n+\t\t\t\"datastore\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tOptional: true,\n+\t\t\t\tForceNew: true,\n+\t\t\t},\n+\t\t},\n+\t}\n+}\n+\n+func resourceVSphereVirtualDiskCreate(d *schema.ResourceData, meta interface{}) error {\n+\tclient := meta.(*govmomi.Client)\n+\n+\tvDisk := virtualDisk{\n+\t\tsize: d.Get(\"size\").(int),\n+\t}\n+\n+\tif v, ok := d.GetOk(\"vmdk_path\"); ok {\n+\t\tvDisk.vmdkPath = v.(string)\n+\t}\n+\n+\tif v, ok := d.GetOk(\"type\"); ok {\n+\t\tvDisk.initType = v.(string)\n+\t}\n+\n+\tif v, ok := d.GetOk(\"datacenter\"); ok {\n+\t\tvDisk.datacenter = v.(string)\n+\t}\n+\n+\tif v, ok := d.GetOk(\"datastore\"); ok {\n+\t\tvDisk.datastore = v.(string)\n+\t}\n+\n+\tdiskPath := fmt.Sprintf(\"[%v] %v\", vDisk.datastore, vDisk.vmdkPath)\n+\n+\terr := createHardDisk(client, vDisk.size, diskPath, vDisk.initType, vDisk.datacenter)\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\td.SetId(diskPath)\n+","path":"builtin/providers/vsphere/resource_vsphere_virtual_disk.go","position":104,"original_position":104,"commit_id":"c79247aa13bd8cb265e04fb5b44ea23be7a3ef09","original_commit_id":"c79247aa13bd8cb265e04fb5b44ea23be7a3ef09","user":{"login":"chrislovecnm","id":335402,"avatar_url":"https://avatars.githubusercontent.com/u/335402?v=3","gravatar_id":"","url":"https://api.github.com/users/chrislovecnm","html_url":"https://github.com/chrislovecnm","followers_url":"https://api.github.com/users/chrislovecnm/followers","following_url":"https://api.github.com/users/chrislovecnm/following{/other_user}","gists_url":"https://api.github.com/users/chrislovecnm/gists{/gist_id}","starred_url":"https://api.github.com/users/chrislovecnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrislovecnm/subscriptions","organizations_url":"https://api.github.com/users/chrislovecnm/orgs","repos_url":"https://api.github.com/users/chrislovecnm/repos","events_url":"https://api.github.com/users/chrislovecnm/events{/privacy}","received_events_url":"https://api.github.com/users/chrislovecnm/received_events","type":"User","site_admin":false},"body":"Should we have some logging?  In general a touch more logging would be nice ;)","created_at":"2016-04-24T00:31:30Z","updated_at":"2016-04-24T00:31:30Z","html_url":"https://github.com/hashicorp/terraform/pull/6273#discussion_r60837056","pull_request_url":"https://api.github.com/repos/hashicorp/terraform/pulls/6273","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/60837056"},"html":{"href":"https://github.com/hashicorp/terraform/pull/6273#discussion_r60837056"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/6273"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/6273","id":67280071,"html_url":"https://github.com/hashicorp/terraform/pull/6273","diff_url":"https://github.com/hashicorp/terraform/pull/6273.diff","patch_url":"https://github.com/hashicorp/terraform/pull/6273.patch","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/6273","number":6273,"state":"open","locked":false,"title":"Adding volume resource creation to vSphere provider","user":{"login":"dkalleg","id":17752190,"avatar_url":"https://avatars.githubusercontent.com/u/17752190?v=3","gravatar_id":"","url":"https://api.github.com/users/dkalleg","html_url":"https://github.com/dkalleg","followers_url":"https://api.github.com/users/dkalleg/followers","following_url":"https://api.github.com/users/dkalleg/following{/other_user}","gists_url":"https://api.github.com/users/dkalleg/gists{/gist_id}","starred_url":"https://api.github.com/users/dkalleg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkalleg/subscriptions","organizations_url":"https://api.github.com/users/dkalleg/orgs","repos_url":"https://api.github.com/users/dkalleg/repos","events_url":"https://api.github.com/users/dkalleg/events{/privacy}","received_events_url":"https://api.github.com/users/dkalleg/received_events","type":"User","site_admin":false},"body":"Allows the user to create a vmdk in vSphere to the given path. Update\r\nnot implemented, further research required.  In the future this could\r\nsupport updates for rename and move.","created_at":"2016-04-21T00:32:13Z","updated_at":"2016-04-24T00:31:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7302b337fa7ed477d725b2084fa282cc66cb0d9f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/terraform/pulls/6273/commits","review_comments_url":"https://api.github.com/repos/hashicorp/terraform/pulls/6273/comments","review_comment_url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/6273/comments","statuses_url":"https://api.github.com/repos/hashicorp/terraform/statuses/c79247aa13bd8cb265e04fb5b44ea23be7a3ef09","head":{"label":"dkalleg:create_virtual_disk","ref":"create_virtual_disk","sha":"c79247aa13bd8cb265e04fb5b44ea23be7a3ef09","user":{"login":"dkalleg","id":17752190,"avatar_url":"https://avatars.githubusercontent.com/u/17752190?v=3","gravatar_id":"","url":"https://api.github.com/users/dkalleg","html_url":"https://github.com/dkalleg","followers_url":"https://api.github.com/users/dkalleg/followers","following_url":"https://api.github.com/users/dkalleg/following{/other_user}","gists_url":"https://api.github.com/users/dkalleg/gists{/gist_id}","starred_url":"https://api.github.com/users/dkalleg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkalleg/subscriptions","organizations_url":"https://api.github.com/users/dkalleg/orgs","repos_url":"https://api.github.com/users/dkalleg/repos","events_url":"https://api.github.com/users/dkalleg/events{/privacy}","received_events_url":"https://api.github.com/users/dkalleg/received_events","type":"User","site_admin":false},"repo":{"id":55269753,"name":"terraform","full_name":"dkalleg/terraform","owner":{"login":"dkalleg","id":17752190,"avatar_url":"https://avatars.githubusercontent.com/u/17752190?v=3","gravatar_id":"","url":"https://api.github.com/users/dkalleg","html_url":"https://github.com/dkalleg","followers_url":"https://api.github.com/users/dkalleg/followers","following_url":"https://api.github.com/users/dkalleg/following{/other_user}","gists_url":"https://api.github.com/users/dkalleg/gists{/gist_id}","starred_url":"https://api.github.com/users/dkalleg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dkalleg/subscriptions","organizations_url":"https://api.github.com/users/dkalleg/orgs","repos_url":"https://api.github.com/users/dkalleg/repos","events_url":"https://api.github.com/users/dkalleg/events{/privacy}","received_events_url":"https://api.github.com/users/dkalleg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dkalleg/terraform","description":"Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.","fork":true,"url":"https://api.github.com/repos/dkalleg/terraform","forks_url":"https://api.github.com/repos/dkalleg/terraform/forks","keys_url":"https://api.github.com/repos/dkalleg/terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dkalleg/terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dkalleg/terraform/teams","hooks_url":"https://api.github.com/repos/dkalleg/terraform/hooks","issue_events_url":"https://api.github.com/repos/dkalleg/terraform/issues/events{/number}","events_url":"https://api.github.com/repos/dkalleg/terraform/events","assignees_url":"https://api.github.com/repos/dkalleg/terraform/assignees{/user}","branches_url":"https://api.github.com/repos/dkalleg/terraform/branches{/branch}","tags_url":"https://api.github.com/repos/dkalleg/terraform/tags","blobs_url":"https://api.github.com/repos/dkalleg/terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dkalleg/terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dkalleg/terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/dkalleg/terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dkalleg/terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/dkalleg/terraform/languages","stargazers_url":"https://api.github.com/repos/dkalleg/terraform/stargazers","contributors_url":"https://api.github.com/repos/dkalleg/terraform/contributors","subscribers_url":"https://api.github.com/repos/dkalleg/terraform/subscribers","subscription_url":"https://api.github.com/repos/dkalleg/terraform/subscription","commits_url":"https://api.github.com/repos/dkalleg/terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/dkalleg/terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/dkalleg/terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/dkalleg/terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/dkalleg/terraform/contents/{+path}","compare_url":"https://api.github.com/repos/dkalleg/terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dkalleg/terraform/merges","archive_url":"https://api.github.com/repos/dkalleg/terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dkalleg/terraform/downloads","issues_url":"https://api.github.com/repos/dkalleg/terraform/issues{/number}","pulls_url":"https://api.github.com/repos/dkalleg/terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/dkalleg/terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/dkalleg/terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dkalleg/terraform/labels{/name}","releases_url":"https://api.github.com/repos/dkalleg/terraform/releases{/id}","deployments_url":"https://api.github.com/repos/dkalleg/terraform/deployments","created_at":"2016-04-02T00:15:49Z","updated_at":"2016-04-02T00:15:59Z","pushed_at":"2016-04-21T00:30:46Z","git_url":"git://github.com/dkalleg/terraform.git","ssh_url":"git@github.com:dkalleg/terraform.git","clone_url":"https://github.com/dkalleg/terraform.git","svn_url":"https://github.com/dkalleg/terraform","homepage":"http://www.terraform.io","size":42883,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"fc07b6315c1cfb70240f2d8c5b6f8bf2766f589c","user":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","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":17728164,"name":"terraform","full_name":"hashicorp/terraform","owner":{"login":"hashicorp","id":761456,"avatar_url":"https://avatars.githubusercontent.com/u/761456?v=3","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/terraform","description":"Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.","fork":false,"url":"https://api.github.com/repos/hashicorp/terraform","forks_url":"https://api.github.com/repos/hashicorp/terraform/forks","keys_url":"https://api.github.com/repos/hashicorp/terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hashicorp/terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hashicorp/terraform/teams","hooks_url":"https://api.github.com/repos/hashicorp/terraform/hooks","issue_events_url":"https://api.github.com/repos/hashicorp/terraform/issues/events{/number}","events_url":"https://api.github.com/repos/hashicorp/terraform/events","assignees_url":"https://api.github.com/repos/hashicorp/terraform/assignees{/user}","branches_url":"https://api.github.com/repos/hashicorp/terraform/branches{/branch}","tags_url":"https://api.github.com/repos/hashicorp/terraform/tags","blobs_url":"https://api.github.com/repos/hashicorp/terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hashicorp/terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hashicorp/terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/hashicorp/terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hashicorp/terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/hashicorp/terraform/languages","stargazers_url":"https://api.github.com/repos/hashicorp/terraform/stargazers","contributors_url":"https://api.github.com/repos/hashicorp/terraform/contributors","subscribers_url":"https://api.github.com/repos/hashicorp/terraform/subscribers","subscription_url":"https://api.github.com/repos/hashicorp/terraform/subscription","commits_url":"https://api.github.com/repos/hashicorp/terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/hashicorp/terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/hashicorp/terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/hashicorp/terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/hashicorp/terraform/contents/{+path}","compare_url":"https://api.github.com/repos/hashicorp/terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hashicorp/terraform/merges","archive_url":"https://api.github.com/repos/hashicorp/terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hashicorp/terraform/downloads","issues_url":"https://api.github.com/repos/hashicorp/terraform/issues{/number}","pulls_url":"https://api.github.com/repos/hashicorp/terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/hashicorp/terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/hashicorp/terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hashicorp/terraform/labels{/name}","releases_url":"https://api.github.com/repos/hashicorp/terraform/releases{/id}","deployments_url":"https://api.github.com/repos/hashicorp/terraform/deployments","created_at":"2014-03-13T22:25:48Z","updated_at":"2016-04-23T22:30:32Z","pushed_at":"2016-04-23T20:49:31Z","git_url":"git://github.com/hashicorp/terraform.git","ssh_url":"git@github.com:hashicorp/terraform.git","clone_url":"https://github.com/hashicorp/terraform.git","svn_url":"https://github.com/hashicorp/terraform","homepage":"https://www.terraform.io/","size":79813,"stargazers_count":4533,"watchers_count":4533,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1329,"mirror_url":null,"open_issues_count":1189,"forks":1329,"open_issues":1189,"watchers":4533,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/6273"},"html":{"href":"https://github.com/hashicorp/terraform/pull/6273"},"issue":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/6273"},"comments":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/6273/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/6273/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/6273/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/terraform/statuses/c79247aa13bd8cb265e04fb5b44ea23be7a3ef09"}}}}