{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/47713546","id":47713546,"diff_hunk":"@@ -0,0 +1,87 @@\n+package azurerm\n+\n+import (\n+\t\"fmt\"\n+\t\"strings\"\n+\n+\t\"github.com/hashicorp/terraform/helper/schema\"\n+\t\"github.com/hashicorp/terraform/terraform\"\n+)\n+\n+// Provider returns a terraform.ResourceProvider.\n+func Provider() terraform.ResourceProvider {\n+\treturn &schema.Provider{\n+\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\"subscription_id\": &schema.Schema{\n+\t\t\t\tType:        schema.TypeString,\n+\t\t\t\tOptional:    true,\n+\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"ARM_SUBSCRIPTION_ID\", \"\"),\n+\t\t\t},\n+\n+\t\t\t\"client_id\": &schema.Schema{\n+\t\t\t\tType:        schema.TypeString,\n+\t\t\t\tOptional:    true,\n+\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"ARM_CLIENT_ID\", \"\"),\n+\t\t\t},\n+\n+\t\t\t\"client_secret\": &schema.Schema{\n+\t\t\t\tType:        schema.TypeString,\n+\t\t\t\tOptional:    true,\n+\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"ARM_CLIENT_SECRET\", \"\"),\n+\t\t\t},\n+\n+\t\t\t\"tenant_id\": &schema.Schema{\n+\t\t\t\tType:        schema.TypeString,\n+\t\t\t\tOptional:    true,\n+\t\t\t\tDefaultFunc: schema.EnvDefaultFunc(\"ARM_TENANT_ID\", \"\"),\n+\t\t\t},\n+\t\t},\n+\n+\t\tResourcesMap: map[string]*schema.Resource{\n+\t\t\t\"azurerm_resource_group\":  resourceArmResourceGroup(),\n+\t\t\t\"azurerm_virtual_network\": resourceArmVirtualNetwork(),\n+\t\t},\n+\n+\t\tConfigureFunc: providerConfigure,\n+\t}\n+}\n+\n+// Config is the configuration structure used to instantiate a\n+// new Azure management client.\n+type Config struct {\n+\tManagementURL string\n+\n+\tSubscriptionID string\n+\tClientID       string\n+\tClientSecret   string\n+\tTenantID       string\n+}\n+\n+const noConfigError = `Credentials must be provided either via subscription_id, client_id,\n+client_secret and tenant_id. Please see the provider documentation for\n+more information on how to obtain these credentials.`\n+\n+func providerConfigure(d *schema.ResourceData) (interface{}, error) {\n+\tconfig := Config{\n+\t\tSubscriptionID: d.Get(\"subscription_id\").(string),\n+\t\tClientID:       d.Get(\"client_id\").(string),\n+\t\tClientSecret:   d.Get(\"client_secret\").(string),\n+\t\tTenantID:       d.Get(\"tenant_id\").(string),\n+\t}\n+\n+\tif config.SubscriptionID == \"\" || config.ClientID == \"\" || config.ClientSecret == \"\" || config.TenantID == \"\" {\n+\t\treturn nil, fmt.Errorf(noConfigError)\n+\t}","path":"builtin/providers/azurerm/provider.go","position":74,"original_position":74,"commit_id":"6fef9288f89f1c7680f8c2d997b249bd175ce3fc","original_commit_id":"6fef9288f89f1c7680f8c2d997b249bd175ce3fc","user":{"login":"phinze","id":37534,"avatar_url":"https://avatars.githubusercontent.com/u/37534?v=3","gravatar_id":"","url":"https://api.github.com/users/phinze","html_url":"https://github.com/phinze","followers_url":"https://api.github.com/users/phinze/followers","following_url":"https://api.github.com/users/phinze/following{/other_user}","gists_url":"https://api.github.com/users/phinze/gists{/gist_id}","starred_url":"https://api.github.com/users/phinze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phinze/subscriptions","organizations_url":"https://api.github.com/users/phinze/orgs","repos_url":"https://api.github.com/users/phinze/repos","events_url":"https://api.github.com/users/phinze/events{/privacy}","received_events_url":"https://api.github.com/users/phinze/received_events","type":"User","site_admin":false},"body":"This is no longer coherent now that there's no config-by-file, yeah? We can just let the schema validate the presence of the four required values?","created_at":"2015-12-15T23:07:48Z","updated_at":"2015-12-15T23:07:48Z","html_url":"https://github.com/hashicorp/terraform/pull/4226#discussion_r47713546","pull_request_url":"https://api.github.com/repos/hashicorp/terraform/pulls/4226","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/47713546"},"html":{"href":"https://github.com/hashicorp/terraform/pull/4226#discussion_r47713546"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/4226"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/4226","id":53069231,"html_url":"https://github.com/hashicorp/terraform/pull/4226","diff_url":"https://github.com/hashicorp/terraform/pull/4226.diff","patch_url":"https://github.com/hashicorp/terraform/pull/4226.patch","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/4226","number":4226,"state":"open","locked":false,"title":"Azure ARM Support","user":{"login":"jen20","id":548524,"avatar_url":"https://avatars.githubusercontent.com/u/548524?v=3","gravatar_id":"","url":"https://api.github.com/users/jen20","html_url":"https://github.com/jen20","followers_url":"https://api.github.com/users/jen20/followers","following_url":"https://api.github.com/users/jen20/following{/other_user}","gists_url":"https://api.github.com/users/jen20/gists{/gist_id}","starred_url":"https://api.github.com/users/jen20/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jen20/subscriptions","organizations_url":"https://api.github.com/users/jen20/orgs","repos_url":"https://api.github.com/users/jen20/repos","events_url":"https://api.github.com/users/jen20/events{/privacy}","received_events_url":"https://api.github.com/users/jen20/received_events","type":"User","site_admin":false},"body":"This is a refactoring of the work begun by @aznashwan in #3808. for ARM support (discussion started in #3212).\r\n\r\nIt was decided that for usability purposes, the ARM API would be added as a new provider. That work is on this branch, along with two of the resources and the requisite documentation. Further work will go onto this branch before merging into `master` when it is sufficiently useful, and when there is a sufficiently robust set of acceptance tests which can be run during the nightly Travis builds in the same manner as the AWS work done by @phinze.","created_at":"2015-12-09T02:32:25Z","updated_at":"2015-12-15T23:07:48Z","closed_at":null,"merged_at":null,"merge_commit_sha":"780b5f213253f9319f91b914cc6279946909ee0c","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/terraform/pulls/4226/commits","review_comments_url":"https://api.github.com/repos/hashicorp/terraform/pulls/4226/comments","review_comment_url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/4226/comments","statuses_url":"https://api.github.com/repos/hashicorp/terraform/statuses/6fef9288f89f1c7680f8c2d997b249bd175ce3fc","head":{"label":"hashicorp:f-azure-arm","ref":"f-azure-arm","sha":"6fef9288f89f1c7680f8c2d997b249bd175ce3fc","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}","created_at":"2014-03-13T22:25:48Z","updated_at":"2015-12-15T21:22:04Z","pushed_at":"2015-12-15T22:59:17Z","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":"http://www.terraform.io","size":50626,"stargazers_count":3580,"watchers_count":3580,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":894,"mirror_url":null,"open_issues_count":767,"forks":894,"open_issues":767,"watchers":3580,"default_branch":"master"}},"base":{"label":"hashicorp:master","ref":"master","sha":"294d59cee40276a35ada7ff84ba021565e258a3f","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}","created_at":"2014-03-13T22:25:48Z","updated_at":"2015-12-15T21:22:04Z","pushed_at":"2015-12-15T22:59:17Z","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":"http://www.terraform.io","size":50626,"stargazers_count":3580,"watchers_count":3580,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":894,"mirror_url":null,"open_issues_count":767,"forks":894,"open_issues":767,"watchers":3580,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/4226"},"html":{"href":"https://github.com/hashicorp/terraform/pull/4226"},"issue":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/4226"},"comments":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/4226/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/4226/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/4226/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/terraform/statuses/6fef9288f89f1c7680f8c2d997b249bd175ce3fc"}}}}