{"action":"created","comment":{"url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/comments/196574581","pull_request_review_id":130155062,"id":196574581,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5NjU3NDU4MQ==","diff_hunk":"@@ -187,48 +187,46 @@ func (p *Provider) Configure(ctx context.Context, req *pulumirpc.ConfigureReques\n \t\t}\n \t}\n \n+\t// First make a Terraform config map out of the variables. We do this before checking for missing properties\n+\t// s.t. we can pull any defaults out of the TF schema.\n+\tconfig, err := MakeTerraformConfig(nil, vars, p.tf.Schema, p.info.Config, true)\n+\tif err != nil {\n+\t\treturn nil, errors.Wrap(err, \"could not marshal config state\")\n+\t}\n+\n+\tif p.info.PreConfigureCallback != nil {\n+\t\tif err = p.info.PreConfigureCallback(vars, config); err != nil {\n+\t\t\treturn nil, err\n+\t\t}\n+\t}\n+\n \t// So we can provide better error messages, do a quick scan of required configs for this\n \t// schema and report any that haven't been supplied.\n \tvar missingKeys []*pulumirpc.ConfigureErrorMissingKeys_MissingKey\n \tfor key, meta := range p.tf.Schema {\n-\t\t_, present := vars[resource.PropertyKey(key)]\n-\t\tif meta.Required && !present {\n-\t\t\tfullyQualifiedKey := tokens.NewModuleToken(p.pkg(), tokens.ModuleName(key))\n+\t\tif meta.Required && !config.IsSet(key) {\n+\t\t\tname := TerraformToPulumiName(key, meta, false)","path":"pkg/tfbridge/provider.go","position":25,"original_position":25,"commit_id":"610d0ba5cd4a752352125e2ebf7eccc37717423c","original_commit_id":"610d0ba5cd4a752352125e2ebf7eccc37717423c","user":{"login":"swgillespie","id":1871912,"node_id":"MDQ6VXNlcjE4NzE5MTI=","avatar_url":"https://avatars2.githubusercontent.com/u/1871912?v=4","gravatar_id":"","url":"https://api.github.com/users/swgillespie","html_url":"https://github.com/swgillespie","followers_url":"https://api.github.com/users/swgillespie/followers","following_url":"https://api.github.com/users/swgillespie/following{/other_user}","gists_url":"https://api.github.com/users/swgillespie/gists{/gist_id}","starred_url":"https://api.github.com/users/swgillespie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swgillespie/subscriptions","organizations_url":"https://api.github.com/users/swgillespie/orgs","repos_url":"https://api.github.com/users/swgillespie/repos","events_url":"https://api.github.com/users/swgillespie/events{/privacy}","received_events_url":"https://api.github.com/users/swgillespie/received_events","type":"User","site_admin":false},"body":"gotcha, thanks!","created_at":"2018-06-19T20:53:08Z","updated_at":"2018-06-19T20:53:08Z","html_url":"https://github.com/pulumi/pulumi-terraform/pull/182#discussion_r196574581","pull_request_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/comments/196574581"},"html":{"href":"https://github.com/pulumi/pulumi-terraform/pull/182#discussion_r196574581"},"pull_request":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182"}},"in_reply_to_id":196573506},"pull_request":{"url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182","id":195931451,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk1OTMxNDUx","html_url":"https://github.com/pulumi/pulumi-terraform/pull/182","diff_url":"https://github.com/pulumi/pulumi-terraform/pull/182.diff","patch_url":"https://github.com/pulumi/pulumi-terraform/pull/182.patch","issue_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/182","number":182,"state":"open","locked":false,"title":"Populate config defaults before checking for missing keys.","user":{"login":"pgavlin","id":1224093,"node_id":"MDQ6VXNlcjEyMjQwOTM=","avatar_url":"https://avatars2.githubusercontent.com/u/1224093?v=4","gravatar_id":"","url":"https://api.github.com/users/pgavlin","html_url":"https://github.com/pgavlin","followers_url":"https://api.github.com/users/pgavlin/followers","following_url":"https://api.github.com/users/pgavlin/following{/other_user}","gists_url":"https://api.github.com/users/pgavlin/gists{/gist_id}","starred_url":"https://api.github.com/users/pgavlin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pgavlin/subscriptions","organizations_url":"https://api.github.com/users/pgavlin/orgs","repos_url":"https://api.github.com/users/pgavlin/repos","events_url":"https://api.github.com/users/pgavlin/events{/privacy}","received_events_url":"https://api.github.com/users/pgavlin/received_events","type":"User","site_admin":false},"body":"The check for missing keys should come after the provider config has\r\nbeen converted from its Pulumi representatinon to its TF representation.\r\nThis give the TF provider a chance to populate any missing properties\r\nwith appropriate defaults.\r\n\r\nFixes #181.","created_at":"2018-06-19T19:21:06Z","updated_at":"2018-06-19T20:53:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bffffbc27789593271376e9eb678bd1b28ec77aa","assignee":null,"assignees":[],"requested_reviewers":[{"login":"lukehoban","id":223467,"node_id":"MDQ6VXNlcjIyMzQ2Nw==","avatar_url":"https://avatars1.githubusercontent.com/u/223467?v=4","gravatar_id":"","url":"https://api.github.com/users/lukehoban","html_url":"https://github.com/lukehoban","followers_url":"https://api.github.com/users/lukehoban/followers","following_url":"https://api.github.com/users/lukehoban/following{/other_user}","gists_url":"https://api.github.com/users/lukehoban/gists{/gist_id}","starred_url":"https://api.github.com/users/lukehoban/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukehoban/subscriptions","organizations_url":"https://api.github.com/users/lukehoban/orgs","repos_url":"https://api.github.com/users/lukehoban/repos","events_url":"https://api.github.com/users/lukehoban/events{/privacy}","received_events_url":"https://api.github.com/users/lukehoban/received_events","type":"User","site_admin":false},{"login":"joeduffy","id":3953235,"node_id":"MDQ6VXNlcjM5NTMyMzU=","avatar_url":"https://avatars3.githubusercontent.com/u/3953235?v=4","gravatar_id":"","url":"https://api.github.com/users/joeduffy","html_url":"https://github.com/joeduffy","followers_url":"https://api.github.com/users/joeduffy/followers","following_url":"https://api.github.com/users/joeduffy/following{/other_user}","gists_url":"https://api.github.com/users/joeduffy/gists{/gist_id}","starred_url":"https://api.github.com/users/joeduffy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joeduffy/subscriptions","organizations_url":"https://api.github.com/users/joeduffy/orgs","repos_url":"https://api.github.com/users/joeduffy/repos","events_url":"https://api.github.com/users/joeduffy/events{/privacy}","received_events_url":"https://api.github.com/users/joeduffy/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182/commits","review_comments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182/comments","review_comment_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/182/comments","statuses_url":"https://api.github.com/repos/pulumi/pulumi-terraform/statuses/610d0ba5cd4a752352125e2ebf7eccc37717423c","head":{"label":"pulumi:pgavlin/providerDefaults","ref":"pgavlin/providerDefaults","sha":"610d0ba5cd4a752352125e2ebf7eccc37717423c","user":{"login":"pulumi","id":21992475,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxOTkyNDc1","avatar_url":"https://avatars0.githubusercontent.com/u/21992475?v=4","gravatar_id":"","url":"https://api.github.com/users/pulumi","html_url":"https://github.com/pulumi","followers_url":"https://api.github.com/users/pulumi/followers","following_url":"https://api.github.com/users/pulumi/following{/other_user}","gists_url":"https://api.github.com/users/pulumi/gists{/gist_id}","starred_url":"https://api.github.com/users/pulumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulumi/subscriptions","organizations_url":"https://api.github.com/users/pulumi/orgs","repos_url":"https://api.github.com/users/pulumi/repos","events_url":"https://api.github.com/users/pulumi/events{/privacy}","received_events_url":"https://api.github.com/users/pulumi/received_events","type":"Organization","site_admin":false},"repo":{"id":95492435,"node_id":"MDEwOlJlcG9zaXRvcnk5NTQ5MjQzNQ==","name":"pulumi-terraform","full_name":"pulumi/pulumi-terraform","owner":{"login":"pulumi","id":21992475,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxOTkyNDc1","avatar_url":"https://avatars0.githubusercontent.com/u/21992475?v=4","gravatar_id":"","url":"https://api.github.com/users/pulumi","html_url":"https://github.com/pulumi","followers_url":"https://api.github.com/users/pulumi/followers","following_url":"https://api.github.com/users/pulumi/following{/other_user}","gists_url":"https://api.github.com/users/pulumi/gists{/gist_id}","starred_url":"https://api.github.com/users/pulumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulumi/subscriptions","organizations_url":"https://api.github.com/users/pulumi/orgs","repos_url":"https://api.github.com/users/pulumi/repos","events_url":"https://api.github.com/users/pulumi/events{/privacy}","received_events_url":"https://api.github.com/users/pulumi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pulumi/pulumi-terraform","description":"A bridge between Pulumi and Terraform","fork":false,"url":"https://api.github.com/repos/pulumi/pulumi-terraform","forks_url":"https://api.github.com/repos/pulumi/pulumi-terraform/forks","keys_url":"https://api.github.com/repos/pulumi/pulumi-terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pulumi/pulumi-terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pulumi/pulumi-terraform/teams","hooks_url":"https://api.github.com/repos/pulumi/pulumi-terraform/hooks","issue_events_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/events{/number}","events_url":"https://api.github.com/repos/pulumi/pulumi-terraform/events","assignees_url":"https://api.github.com/repos/pulumi/pulumi-terraform/assignees{/user}","branches_url":"https://api.github.com/repos/pulumi/pulumi-terraform/branches{/branch}","tags_url":"https://api.github.com/repos/pulumi/pulumi-terraform/tags","blobs_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pulumi/pulumi-terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/pulumi/pulumi-terraform/languages","stargazers_url":"https://api.github.com/repos/pulumi/pulumi-terraform/stargazers","contributors_url":"https://api.github.com/repos/pulumi/pulumi-terraform/contributors","subscribers_url":"https://api.github.com/repos/pulumi/pulumi-terraform/subscribers","subscription_url":"https://api.github.com/repos/pulumi/pulumi-terraform/subscription","commits_url":"https://api.github.com/repos/pulumi/pulumi-terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/pulumi/pulumi-terraform/contents/{+path}","compare_url":"https://api.github.com/repos/pulumi/pulumi-terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pulumi/pulumi-terraform/merges","archive_url":"https://api.github.com/repos/pulumi/pulumi-terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pulumi/pulumi-terraform/downloads","issues_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues{/number}","pulls_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/pulumi/pulumi-terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/pulumi/pulumi-terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pulumi/pulumi-terraform/labels{/name}","releases_url":"https://api.github.com/repos/pulumi/pulumi-terraform/releases{/id}","deployments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/deployments","created_at":"2017-06-26T21:49:20Z","updated_at":"2018-06-19T19:59:52Z","pushed_at":"2018-06-19T19:31:25Z","git_url":"git://github.com/pulumi/pulumi-terraform.git","ssh_url":"git@github.com:pulumi/pulumi-terraform.git","clone_url":"https://github.com/pulumi/pulumi-terraform.git","svn_url":"https://github.com/pulumi/pulumi-terraform","homepage":"","size":920,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":30,"watchers":5,"default_branch":"master"}},"base":{"label":"pulumi:master","ref":"master","sha":"3297a790c8235ba3331b65b129ce28fc222fe658","user":{"login":"pulumi","id":21992475,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxOTkyNDc1","avatar_url":"https://avatars0.githubusercontent.com/u/21992475?v=4","gravatar_id":"","url":"https://api.github.com/users/pulumi","html_url":"https://github.com/pulumi","followers_url":"https://api.github.com/users/pulumi/followers","following_url":"https://api.github.com/users/pulumi/following{/other_user}","gists_url":"https://api.github.com/users/pulumi/gists{/gist_id}","starred_url":"https://api.github.com/users/pulumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulumi/subscriptions","organizations_url":"https://api.github.com/users/pulumi/orgs","repos_url":"https://api.github.com/users/pulumi/repos","events_url":"https://api.github.com/users/pulumi/events{/privacy}","received_events_url":"https://api.github.com/users/pulumi/received_events","type":"Organization","site_admin":false},"repo":{"id":95492435,"node_id":"MDEwOlJlcG9zaXRvcnk5NTQ5MjQzNQ==","name":"pulumi-terraform","full_name":"pulumi/pulumi-terraform","owner":{"login":"pulumi","id":21992475,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIxOTkyNDc1","avatar_url":"https://avatars0.githubusercontent.com/u/21992475?v=4","gravatar_id":"","url":"https://api.github.com/users/pulumi","html_url":"https://github.com/pulumi","followers_url":"https://api.github.com/users/pulumi/followers","following_url":"https://api.github.com/users/pulumi/following{/other_user}","gists_url":"https://api.github.com/users/pulumi/gists{/gist_id}","starred_url":"https://api.github.com/users/pulumi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulumi/subscriptions","organizations_url":"https://api.github.com/users/pulumi/orgs","repos_url":"https://api.github.com/users/pulumi/repos","events_url":"https://api.github.com/users/pulumi/events{/privacy}","received_events_url":"https://api.github.com/users/pulumi/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pulumi/pulumi-terraform","description":"A bridge between Pulumi and Terraform","fork":false,"url":"https://api.github.com/repos/pulumi/pulumi-terraform","forks_url":"https://api.github.com/repos/pulumi/pulumi-terraform/forks","keys_url":"https://api.github.com/repos/pulumi/pulumi-terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pulumi/pulumi-terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pulumi/pulumi-terraform/teams","hooks_url":"https://api.github.com/repos/pulumi/pulumi-terraform/hooks","issue_events_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/events{/number}","events_url":"https://api.github.com/repos/pulumi/pulumi-terraform/events","assignees_url":"https://api.github.com/repos/pulumi/pulumi-terraform/assignees{/user}","branches_url":"https://api.github.com/repos/pulumi/pulumi-terraform/branches{/branch}","tags_url":"https://api.github.com/repos/pulumi/pulumi-terraform/tags","blobs_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pulumi/pulumi-terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/pulumi/pulumi-terraform/languages","stargazers_url":"https://api.github.com/repos/pulumi/pulumi-terraform/stargazers","contributors_url":"https://api.github.com/repos/pulumi/pulumi-terraform/contributors","subscribers_url":"https://api.github.com/repos/pulumi/pulumi-terraform/subscribers","subscription_url":"https://api.github.com/repos/pulumi/pulumi-terraform/subscription","commits_url":"https://api.github.com/repos/pulumi/pulumi-terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/pulumi/pulumi-terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/pulumi/pulumi-terraform/contents/{+path}","compare_url":"https://api.github.com/repos/pulumi/pulumi-terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pulumi/pulumi-terraform/merges","archive_url":"https://api.github.com/repos/pulumi/pulumi-terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pulumi/pulumi-terraform/downloads","issues_url":"https://api.github.com/repos/pulumi/pulumi-terraform/issues{/number}","pulls_url":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/pulumi/pulumi-terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/pulumi/pulumi-terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pulumi/pulumi-terraform/labels{/name}","releases_url":"https://api.github.com/repos/pulumi/pulumi-terraform/releases{/id}","deployments_url":"https://api.github.com/repos/pulumi/pulumi-terraform/deployments","created_at":"2017-06-26T21:49:20Z","updated_at":"2018-06-19T19:59:52Z","pushed_at":"2018-06-19T19:31:25Z","git_url":"git://github.com/pulumi/pulumi-terraform.git","ssh_url":"git@github.com:pulumi/pulumi-terraform.git","clone_url":"https://github.com/pulumi/pulumi-terraform.git","svn_url":"https://github.com/pulumi/pulumi-terraform","homepage":"","size":920,"stargazers_count":5,"watchers_count":5,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":30,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":30,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182"},"html":{"href":"https://github.com/pulumi/pulumi-terraform/pull/182"},"issue":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/182"},"comments":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/issues/182/comments"},"review_comments":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182/comments"},"review_comment":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/pulls/182/commits"},"statuses":{"href":"https://api.github.com/repos/pulumi/pulumi-terraform/statuses/610d0ba5cd4a752352125e2ebf7eccc37717423c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"swgillespie"}}