{"action":"created","comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments/171068477","pull_request_review_id":99857511,"id":171068477,"diff_hunk":"@@ -0,0 +1,228 @@\n+package aws\n+\n+import (\n+\t\"fmt\"\n+\t\"log\"\n+\t\"regexp\"\n+\t\"time\"\n+\n+\t\"github.com/aws/aws-sdk-go/aws\"\n+\t\"github.com/aws/aws-sdk-go/aws/awserr\"\n+\t\"github.com/aws/aws-sdk-go/service/organizations\"\n+\t\"github.com/hashicorp/terraform/helper/resource\"\n+\t\"github.com/hashicorp/terraform/helper/schema\"\n+\t\"github.com/hashicorp/terraform/helper/validation\"\n+)\n+\n+func resourceAwsOrganizationsAccount() *schema.Resource {\n+\treturn &schema.Resource{\n+\t\tCreate: resourceAwsOrganizationsAccountCreate,\n+\t\tRead:   resourceAwsOrganizationsAccountRead,\n+\t\tDelete: resourceAwsOrganizationsAccountDelete,\n+\t\tImporter: &schema.ResourceImporter{\n+\t\t\tState: schema.ImportStatePassthrough,\n+\t\t},\n+\n+\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\"arn\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"joined_method\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"joined_timestamp\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"status\": {\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tComputed: true,\n+\t\t\t},\n+\t\t\t\"name\": {\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tRequired:     true,\n+\t\t\t\tValidateFunc: validation.StringLenBetween(1, 50),\n+\t\t\t},\n+\t\t\t\"email\": {\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tRequired:     true,\n+\t\t\t\tValidateFunc: validateAwsOrganizationsAccountEmail,\n+\t\t\t},\n+\t\t\t\"iam_user_access_to_billing\": {\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tOptional:     true,\n+\t\t\t\tValidateFunc: validation.StringInSlice([]string{organizations.IAMUserAccessToBillingAllow, organizations.IAMUserAccessToBillingDeny}, true),\n+\t\t\t},\n+\t\t\t\"role_name\": {\n+\t\t\t\tForceNew:     true,\n+\t\t\t\tType:         schema.TypeString,\n+\t\t\t\tOptional:     true,\n+\t\t\t\tValidateFunc: validateAwsOrganizationsAccountRoleName,\n+\t\t\t},\n+\t\t},\n+\t}\n+}\n+\n+func resourceAwsOrganizationsAccountCreate(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).organizationsconn\n+\n+\t// Create the account\n+\tcreateOpts := &organizations.CreateAccountInput{\n+\t\tAccountName: aws.String(d.Get(\"name\").(string)),\n+\t\tEmail:       aws.String(d.Get(\"email\").(string)),\n+\t}\n+\tif role, ok := d.GetOk(\"role_name\"); ok {\n+\t\tcreateOpts.RoleName = aws.String(role.(string))\n+\t}\n+\n+\tif iam_user, ok := d.GetOk(\"iam_user_access_to_billing\"); ok {\n+\t\tcreateOpts.IamUserAccessToBilling = aws.String(iam_user.(string))\n+\t}\n+\n+\tlog.Printf(\"[DEBUG] Account create config: %#v\", createOpts)\n+\n+\tvar err error\n+\tvar resp *organizations.CreateAccountOutput\n+\terr = resource.Retry(4*time.Minute, func() *resource.RetryError {\n+\t\tresp, err = conn.CreateAccount(createOpts)\n+\n+\t\tif err != nil {\n+\t\t\tec2err, ok := err.(awserr.Error)\n+\t\t\tif !ok {","path":"aws/resource_aws_organizations_account.go","position":96,"original_position":96,"commit_id":"ecbf076b68c84904a0f24ed5876d13bd3a1c77cf","original_commit_id":"ecbf076b68c84904a0f24ed5876d13bd3a1c77cf","user":{"login":"asedge","id":4359059,"avatar_url":"https://avatars0.githubusercontent.com/u/4359059?v=4","gravatar_id":"","url":"https://api.github.com/users/asedge","html_url":"https://github.com/asedge","followers_url":"https://api.github.com/users/asedge/followers","following_url":"https://api.github.com/users/asedge/following{/other_user}","gists_url":"https://api.github.com/users/asedge/gists{/gist_id}","starred_url":"https://api.github.com/users/asedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asedge/subscriptions","organizations_url":"https://api.github.com/users/asedge/orgs","repos_url":"https://api.github.com/users/asedge/repos","events_url":"https://api.github.com/users/asedge/events{/privacy}","received_events_url":"https://api.github.com/users/asedge/received_events","type":"User","site_admin":false},"body":"This may have been a mistake from when I was trying to clean up.","created_at":"2018-02-27T21:15:23Z","updated_at":"2018-02-27T21:15:23Z","html_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524#discussion_r171068477","pull_request_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments/171068477"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524#discussion_r171068477"},"pull_request":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524"}},"in_reply_to_id":170648208},"pull_request":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524","id":171232334,"html_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524","diff_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524.diff","patch_url":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524.patch","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/3524","number":3524,"state":"open","locked":false,"title":"New Resource: aws_organizations_account","user":{"login":"asedge","id":4359059,"avatar_url":"https://avatars0.githubusercontent.com/u/4359059?v=4","gravatar_id":"","url":"https://api.github.com/users/asedge","html_url":"https://github.com/asedge","followers_url":"https://api.github.com/users/asedge/followers","following_url":"https://api.github.com/users/asedge/following{/other_user}","gists_url":"https://api.github.com/users/asedge/gists{/gist_id}","starred_url":"https://api.github.com/users/asedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asedge/subscriptions","organizations_url":"https://api.github.com/users/asedge/orgs","repos_url":"https://api.github.com/users/asedge/repos","events_url":"https://api.github.com/users/asedge/events{/privacy}","received_events_url":"https://api.github.com/users/asedge/received_events","type":"User","site_admin":false},"body":"A new resource to implement AWS Organizations member accounts: #571.\r\n\r\nI updated the branch based on feedback from #903.  There's probably more to fix up because this branch hadn't been touched in quite a while.  This is quite a bit more difficult to test because once you create a member account in an organization that organization cannot be deleted.  The member accounts themselves cannot be deleted, only suspended, and each account creation consumes an email address that cannot be reused.\r\n\r\nOriginally attempted a PR at: hashicorp/terraform#14147.\r\n\r\nCC: @bflad ","created_at":"2018-02-25T14:20:39Z","updated_at":"2018-02-27T21:15:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f8d26145666b03982fab773a31df59ee5b7af1ce","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":625892945,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels/new-resource","name":"new-resource","color":"d4c5f9","default":false},{"id":801971598,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels/service/organizations","name":"service/organizations","color":"bfd4f2","default":false},{"id":737832189,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels/size/L","name":"size/L","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524/commits","review_comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524/comments","review_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments{/number}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/3524/comments","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/ecbf076b68c84904a0f24ed5876d13bd3a1c77cf","head":{"label":"asedge:resource_aws_organizations_account","ref":"resource_aws_organizations_account","sha":"ecbf076b68c84904a0f24ed5876d13bd3a1c77cf","user":{"login":"asedge","id":4359059,"avatar_url":"https://avatars0.githubusercontent.com/u/4359059?v=4","gravatar_id":"","url":"https://api.github.com/users/asedge","html_url":"https://github.com/asedge","followers_url":"https://api.github.com/users/asedge/followers","following_url":"https://api.github.com/users/asedge/following{/other_user}","gists_url":"https://api.github.com/users/asedge/gists{/gist_id}","starred_url":"https://api.github.com/users/asedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asedge/subscriptions","organizations_url":"https://api.github.com/users/asedge/orgs","repos_url":"https://api.github.com/users/asedge/repos","events_url":"https://api.github.com/users/asedge/events{/privacy}","received_events_url":"https://api.github.com/users/asedge/received_events","type":"User","site_admin":false},"repo":{"id":94721641,"name":"terraform-provider-aws","full_name":"asedge/terraform-provider-aws","owner":{"login":"asedge","id":4359059,"avatar_url":"https://avatars0.githubusercontent.com/u/4359059?v=4","gravatar_id":"","url":"https://api.github.com/users/asedge","html_url":"https://github.com/asedge","followers_url":"https://api.github.com/users/asedge/followers","following_url":"https://api.github.com/users/asedge/following{/other_user}","gists_url":"https://api.github.com/users/asedge/gists{/gist_id}","starred_url":"https://api.github.com/users/asedge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asedge/subscriptions","organizations_url":"https://api.github.com/users/asedge/orgs","repos_url":"https://api.github.com/users/asedge/repos","events_url":"https://api.github.com/users/asedge/events{/privacy}","received_events_url":"https://api.github.com/users/asedge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/asedge/terraform-provider-aws","description":"Terraform aws provider","fork":true,"url":"https://api.github.com/repos/asedge/terraform-provider-aws","forks_url":"https://api.github.com/repos/asedge/terraform-provider-aws/forks","keys_url":"https://api.github.com/repos/asedge/terraform-provider-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/asedge/terraform-provider-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/asedge/terraform-provider-aws/teams","hooks_url":"https://api.github.com/repos/asedge/terraform-provider-aws/hooks","issue_events_url":"https://api.github.com/repos/asedge/terraform-provider-aws/issues/events{/number}","events_url":"https://api.github.com/repos/asedge/terraform-provider-aws/events","assignees_url":"https://api.github.com/repos/asedge/terraform-provider-aws/assignees{/user}","branches_url":"https://api.github.com/repos/asedge/terraform-provider-aws/branches{/branch}","tags_url":"https://api.github.com/repos/asedge/terraform-provider-aws/tags","blobs_url":"https://api.github.com/repos/asedge/terraform-provider-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/asedge/terraform-provider-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/asedge/terraform-provider-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/asedge/terraform-provider-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/asedge/terraform-provider-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/asedge/terraform-provider-aws/languages","stargazers_url":"https://api.github.com/repos/asedge/terraform-provider-aws/stargazers","contributors_url":"https://api.github.com/repos/asedge/terraform-provider-aws/contributors","subscribers_url":"https://api.github.com/repos/asedge/terraform-provider-aws/subscribers","subscription_url":"https://api.github.com/repos/asedge/terraform-provider-aws/subscription","commits_url":"https://api.github.com/repos/asedge/terraform-provider-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/asedge/terraform-provider-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/asedge/terraform-provider-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/asedge/terraform-provider-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/asedge/terraform-provider-aws/contents/{+path}","compare_url":"https://api.github.com/repos/asedge/terraform-provider-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/asedge/terraform-provider-aws/merges","archive_url":"https://api.github.com/repos/asedge/terraform-provider-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/asedge/terraform-provider-aws/downloads","issues_url":"https://api.github.com/repos/asedge/terraform-provider-aws/issues{/number}","pulls_url":"https://api.github.com/repos/asedge/terraform-provider-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/asedge/terraform-provider-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/asedge/terraform-provider-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/asedge/terraform-provider-aws/labels{/name}","releases_url":"https://api.github.com/repos/asedge/terraform-provider-aws/releases{/id}","deployments_url":"https://api.github.com/repos/asedge/terraform-provider-aws/deployments","created_at":"2017-06-19T00:37:31Z","updated_at":"2017-06-19T00:37:36Z","pushed_at":"2018-02-25T18:42:44Z","git_url":"git://github.com/asedge/terraform-provider-aws.git","ssh_url":"git@github.com:asedge/terraform-provider-aws.git","clone_url":"https://github.com/asedge/terraform-provider-aws.git","svn_url":"https://github.com/asedge/terraform-provider-aws","homepage":"","size":29759,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"terraform-providers:master","ref":"master","sha":"7223d8f081e2c6ce16ea0a9593b689891b25d606","user":{"login":"terraform-providers","id":29154831,"avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"repo":{"id":93444615,"name":"terraform-provider-aws","full_name":"terraform-providers/terraform-provider-aws","owner":{"login":"terraform-providers","id":29154831,"avatar_url":"https://avatars0.githubusercontent.com/u/29154831?v=4","gravatar_id":"","url":"https://api.github.com/users/terraform-providers","html_url":"https://github.com/terraform-providers","followers_url":"https://api.github.com/users/terraform-providers/followers","following_url":"https://api.github.com/users/terraform-providers/following{/other_user}","gists_url":"https://api.github.com/users/terraform-providers/gists{/gist_id}","starred_url":"https://api.github.com/users/terraform-providers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/terraform-providers/subscriptions","organizations_url":"https://api.github.com/users/terraform-providers/orgs","repos_url":"https://api.github.com/users/terraform-providers/repos","events_url":"https://api.github.com/users/terraform-providers/events{/privacy}","received_events_url":"https://api.github.com/users/terraform-providers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/terraform-providers/terraform-provider-aws","description":"Terraform AWS provider","fork":false,"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws","forks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/forks","keys_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/keys{/key_id}","collaborators_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/teams","hooks_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/hooks","issue_events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/events{/number}","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/events","assignees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/assignees{/user}","branches_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/branches{/branch}","tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/tags","blobs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/refs{/sha}","trees_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/trees{/sha}","statuses_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/{sha}","languages_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/languages","stargazers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/stargazers","contributors_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/contributors","subscribers_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/subscribers","subscription_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/subscription","commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/commits{/sha}","git_commits_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/git/commits{/sha}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/comments{/number}","issue_comment_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/comments{/number}","contents_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/contents/{+path}","compare_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/compare/{base}...{head}","merges_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/merges","archive_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/downloads","issues_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues{/number}","pulls_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls{/number}","milestones_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/milestones{/number}","notifications_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels{/name}","releases_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/releases{/id}","deployments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/deployments","created_at":"2017-06-05T20:37:52Z","updated_at":"2018-02-27T17:16:55Z","pushed_at":"2018-02-27T21:07:11Z","git_url":"git://github.com/terraform-providers/terraform-provider-aws.git","ssh_url":"git@github.com:terraform-providers/terraform-provider-aws.git","clone_url":"https://github.com/terraform-providers/terraform-provider-aws.git","svn_url":"https://github.com/terraform-providers/terraform-provider-aws","homepage":"https://www.terraform.io/docs/providers/aws/","size":30324,"stargazers_count":850,"watchers_count":850,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":771,"mirror_url":null,"archived":false,"open_issues_count":1725,"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"},"forks":771,"open_issues":1725,"watchers":850,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524"},"html":{"href":"https://github.com/terraform-providers/terraform-provider-aws/pull/3524"},"issue":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/3524"},"comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/3524/comments"},"review_comments":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524/comments"},"review_comment":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/pulls/3524/commits"},"statuses":{"href":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/statuses/ecbf076b68c84904a0f24ed5876d13bd3a1c77cf"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"asedge"}}