{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/85521569","pull_request_review_id":6233761,"id":85521569,"diff_hunk":"@@ -0,0 +1,205 @@\n+package aws\n+\n+import (\n+\t\"log\"\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/waf\"\n+\t\"github.com/hashicorp/errwrap\"\n+\t\"github.com/hashicorp/terraform/helper/schema\"\n+)\n+\n+func resourceAwsWafByteMatchSet() *schema.Resource {\n+\treturn &schema.Resource{\n+\t\tCreate: resourceAwsWafByteMatchSetCreate,\n+\t\tRead:   resourceAwsWafByteMatchSetRead,\n+\t\tUpdate: resourceAwsWafByteMatchSetUpdate,\n+\t\tDelete: resourceAwsWafByteMatchSetDelete,\n+\n+\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\"name\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeString,\n+\t\t\t\tRequired: true,\n+\t\t\t\tForceNew: true,\n+\t\t\t},\n+\t\t\t\"byte_match_tuples\": &schema.Schema{\n+\t\t\t\tType:     schema.TypeSet,\n+\t\t\t\tOptional: true,\n+\t\t\t\tElem: &schema.Resource{\n+\t\t\t\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\t\t\t\"field_to_match\": {\n+\t\t\t\t\t\t\tType:     schema.TypeSet,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t\tMaxItems: 1,\n+\t\t\t\t\t\t\tElem: &schema.Resource{\n+\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n+\t\t\t\t\t\t\t\t\t\"data\": {\n+\t\t\t\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t\t\t\t},\n+\t\t\t\t\t\t\t\t\t\"type\": {\n+\t\t\t\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t\t\t\t},\n+\t\t\t\t\t\t\t\t},\n+\t\t\t\t\t\t\t},\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"positional_constraint\": &schema.Schema{\n+\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"target_string\": &schema.Schema{\n+\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\tOptional: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t\t\"text_transformation\": &schema.Schema{\n+\t\t\t\t\t\t\tType:     schema.TypeString,\n+\t\t\t\t\t\t\tRequired: true,\n+\t\t\t\t\t\t},\n+\t\t\t\t\t},\n+\t\t\t\t},\n+\t\t\t},\n+\t\t},\n+\t}\n+}\n+\n+func resourceAwsWafByteMatchSetCreate(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).wafconn\n+\n+\tlog.Printf(\"[INFO] Creating ByteMatchSet: %s\", d.Get(\"name\").(string))\n+\n+\t// ChangeToken\n+\tvar ct *waf.GetChangeTokenInput\n+\n+\tres, err := conn.GetChangeToken(ct)\n+\tif err != nil {\n+\t\treturn errwrap.Wrapf(\"[ERROR] Error getting change token: {{err}}\", err)\n+\t}\n+\n+\tparams := &waf.CreateByteMatchSetInput{\n+\t\tChangeToken: res.ChangeToken,\n+\t\tName:        aws.String(d.Get(\"name\").(string)),\n+\t}\n+\n+\tresp, err := conn.CreateByteMatchSet(params)\n+\n+\tif err != nil {\n+\t\treturn errwrap.Wrapf(\"[ERROR] Error creating ByteMatchSet: {{err}}\", err)\n+\t}\n+\n+\td.SetId(*resp.ByteMatchSet.ByteMatchSetId)\n+\n+\treturn resourceAwsWafByteMatchSetUpdate(d, meta)\n+}\n+\n+func resourceAwsWafByteMatchSetRead(d *schema.ResourceData, meta interface{}) error {\n+\tconn := meta.(*AWSClient).wafconn\n+\tlog.Printf(\"[INFO] Reading ByteMatchSet: %s\", d.Get(\"name\").(string))\n+\tparams := &waf.GetByteMatchSetInput{\n+\t\tByteMatchSetId: aws.String(d.Id()),\n+\t}\n+\n+\tresp, err := conn.GetByteMatchSet(params)\n+\tif err != nil {\n+\t\tif awsErr, ok := err.(awserr.Error); ok && awsErr.Code() == \"WAFNonexistentItemException\" {\n+\t\t\tlog.Printf(\"[WARN] WAF IPSet (%s) not found, error code (404)\", d.Id())\n+\t\t\td.SetId(\"\")\n+\t\t\treturn nil\n+\t\t}\n+\n+\t\treturn err\n+\t}\n+\n+\td.Set(\"name\", resp.ByteMatchSet.Name)","path":"builtin/providers/aws/resource_aws_waf_byte_match_set.go","position":114,"original_position":114,"commit_id":"fd05f9e9e8a0aab418e44fb152e426048dd632f3","original_commit_id":"fd05f9e9e8a0aab418e44fb152e426048dd632f3","user":{"login":"stack72","id":227823,"avatar_url":"https://avatars.githubusercontent.com/u/227823?v=3","gravatar_id":"","url":"https://api.github.com/users/stack72","html_url":"https://github.com/stack72","followers_url":"https://api.github.com/users/stack72/followers","following_url":"https://api.github.com/users/stack72/following{/other_user}","gists_url":"https://api.github.com/users/stack72/gists{/gist_id}","starred_url":"https://api.github.com/users/stack72/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stack72/subscriptions","organizations_url":"https://api.github.com/users/stack72/orgs","repos_url":"https://api.github.com/users/stack72/repos","events_url":"https://api.github.com/users/stack72/events{/privacy}","received_events_url":"https://api.github.com/users/stack72/received_events","type":"User","site_admin":false},"body":"Thanks :)","created_at":"2016-10-28T12:36:13Z","updated_at":"2016-10-28T12:36:13Z","html_url":"https://github.com/hashicorp/terraform/pull/9681#discussion_r85521569","pull_request_url":"https://api.github.com/repos/hashicorp/terraform/pulls/9681","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/85521569"},"html":{"href":"https://github.com/hashicorp/terraform/pull/9681#discussion_r85521569"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/9681"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/9681","id":91350674,"html_url":"https://github.com/hashicorp/terraform/pull/9681","diff_url":"https://github.com/hashicorp/terraform/pull/9681.diff","patch_url":"https://github.com/hashicorp/terraform/pull/9681.patch","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/9681","number":9681,"state":"open","locked":false,"title":"Added AWS Resource WAF ByteMatchSet","user":{"login":"optimisticanshul","id":4547169,"avatar_url":"https://avatars.githubusercontent.com/u/4547169?v=3","gravatar_id":"","url":"https://api.github.com/users/optimisticanshul","html_url":"https://github.com/optimisticanshul","followers_url":"https://api.github.com/users/optimisticanshul/followers","following_url":"https://api.github.com/users/optimisticanshul/following{/other_user}","gists_url":"https://api.github.com/users/optimisticanshul/gists{/gist_id}","starred_url":"https://api.github.com/users/optimisticanshul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimisticanshul/subscriptions","organizations_url":"https://api.github.com/users/optimisticanshul/orgs","repos_url":"https://api.github.com/users/optimisticanshul/repos","events_url":"https://api.github.com/users/optimisticanshul/events{/privacy}","received_events_url":"https://api.github.com/users/optimisticanshul/received_events","type":"User","site_admin":false},"body":"```\r\n➜  terraform git:(resource-aws-waf-byte-match-set) ✗ make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSWafByteMatchSet_'\r\n==> Checking that code complies with gofmt requirements...\r\ngo generate $(go list ./... | grep -v /terraform/vendor/)\r\n2016/10/28 14:54:27 Generated command/internal_plugin_list.go\r\nTF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSWafByteMatchSet_ -timeout 120m\r\n=== RUN   TestAccAWSWafByteMatchSet_basic\r\n--- PASS: TestAccAWSWafByteMatchSet_basic (65.40s)\r\n=== RUN   TestAccAWSWafByteMatchSet_changeNameForceNew\r\n--- PASS: TestAccAWSWafByteMatchSet_changeNameForceNew (117.77s)\r\n=== RUN   TestAccAWSWafByteMatchSet_disappears\r\n--- PASS: TestAccAWSWafByteMatchSet_disappears (61.17s)\r\nPASS\r\nok  \tgithub.com/hashicorp/terraform/builtin/providers/aws\t249.671s\r\n```","created_at":"2016-10-28T09:37:14Z","updated_at":"2016-10-28T12:36:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6616a236f715a5b8ea169cb614f66f75415bb5f5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/terraform/pulls/9681/commits","review_comments_url":"https://api.github.com/repos/hashicorp/terraform/pulls/9681/comments","review_comment_url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/9681/comments","statuses_url":"https://api.github.com/repos/hashicorp/terraform/statuses/fd05f9e9e8a0aab418e44fb152e426048dd632f3","head":{"label":"optimisticanshul:resource-aws-waf-byte-match-set","ref":"resource-aws-waf-byte-match-set","sha":"fd05f9e9e8a0aab418e44fb152e426048dd632f3","user":{"login":"optimisticanshul","id":4547169,"avatar_url":"https://avatars.githubusercontent.com/u/4547169?v=3","gravatar_id":"","url":"https://api.github.com/users/optimisticanshul","html_url":"https://github.com/optimisticanshul","followers_url":"https://api.github.com/users/optimisticanshul/followers","following_url":"https://api.github.com/users/optimisticanshul/following{/other_user}","gists_url":"https://api.github.com/users/optimisticanshul/gists{/gist_id}","starred_url":"https://api.github.com/users/optimisticanshul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimisticanshul/subscriptions","organizations_url":"https://api.github.com/users/optimisticanshul/orgs","repos_url":"https://api.github.com/users/optimisticanshul/repos","events_url":"https://api.github.com/users/optimisticanshul/events{/privacy}","received_events_url":"https://api.github.com/users/optimisticanshul/received_events","type":"User","site_admin":false},"repo":{"id":66435960,"name":"terraform","full_name":"optimisticanshul/terraform","owner":{"login":"optimisticanshul","id":4547169,"avatar_url":"https://avatars.githubusercontent.com/u/4547169?v=3","gravatar_id":"","url":"https://api.github.com/users/optimisticanshul","html_url":"https://github.com/optimisticanshul","followers_url":"https://api.github.com/users/optimisticanshul/followers","following_url":"https://api.github.com/users/optimisticanshul/following{/other_user}","gists_url":"https://api.github.com/users/optimisticanshul/gists{/gist_id}","starred_url":"https://api.github.com/users/optimisticanshul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/optimisticanshul/subscriptions","organizations_url":"https://api.github.com/users/optimisticanshul/orgs","repos_url":"https://api.github.com/users/optimisticanshul/repos","events_url":"https://api.github.com/users/optimisticanshul/events{/privacy}","received_events_url":"https://api.github.com/users/optimisticanshul/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/optimisticanshul/terraform","description":"Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.","fork":true,"url":"https://api.github.com/repos/optimisticanshul/terraform","forks_url":"https://api.github.com/repos/optimisticanshul/terraform/forks","keys_url":"https://api.github.com/repos/optimisticanshul/terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/optimisticanshul/terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/optimisticanshul/terraform/teams","hooks_url":"https://api.github.com/repos/optimisticanshul/terraform/hooks","issue_events_url":"https://api.github.com/repos/optimisticanshul/terraform/issues/events{/number}","events_url":"https://api.github.com/repos/optimisticanshul/terraform/events","assignees_url":"https://api.github.com/repos/optimisticanshul/terraform/assignees{/user}","branches_url":"https://api.github.com/repos/optimisticanshul/terraform/branches{/branch}","tags_url":"https://api.github.com/repos/optimisticanshul/terraform/tags","blobs_url":"https://api.github.com/repos/optimisticanshul/terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/optimisticanshul/terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/optimisticanshul/terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/optimisticanshul/terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/optimisticanshul/terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/optimisticanshul/terraform/languages","stargazers_url":"https://api.github.com/repos/optimisticanshul/terraform/stargazers","contributors_url":"https://api.github.com/repos/optimisticanshul/terraform/contributors","subscribers_url":"https://api.github.com/repos/optimisticanshul/terraform/subscribers","subscription_url":"https://api.github.com/repos/optimisticanshul/terraform/subscription","commits_url":"https://api.github.com/repos/optimisticanshul/terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/optimisticanshul/terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/optimisticanshul/terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/optimisticanshul/terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/optimisticanshul/terraform/contents/{+path}","compare_url":"https://api.github.com/repos/optimisticanshul/terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/optimisticanshul/terraform/merges","archive_url":"https://api.github.com/repos/optimisticanshul/terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/optimisticanshul/terraform/downloads","issues_url":"https://api.github.com/repos/optimisticanshul/terraform/issues{/number}","pulls_url":"https://api.github.com/repos/optimisticanshul/terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/optimisticanshul/terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/optimisticanshul/terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/optimisticanshul/terraform/labels{/name}","releases_url":"https://api.github.com/repos/optimisticanshul/terraform/releases{/id}","deployments_url":"https://api.github.com/repos/optimisticanshul/terraform/deployments","created_at":"2016-08-24T06:18:40Z","updated_at":"2016-08-24T06:18:49Z","pushed_at":"2016-10-28T09:36:20Z","git_url":"git://github.com/optimisticanshul/terraform.git","ssh_url":"git@github.com:optimisticanshul/terraform.git","clone_url":"https://github.com/optimisticanshul/terraform.git","svn_url":"https://github.com/optimisticanshul/terraform","homepage":"https://www.terraform.io/","size":59748,"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":"3500630243a167bf0b88b18bf27a221e2f7c6707","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-10-28T10:15:25Z","pushed_at":"2016-10-28T11:28:47Z","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":147113,"stargazers_count":6063,"watchers_count":6063,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":2075,"mirror_url":null,"open_issues_count":1763,"forks":2075,"open_issues":1763,"watchers":6063,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/9681"},"html":{"href":"https://github.com/hashicorp/terraform/pull/9681"},"issue":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/9681"},"comments":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/9681/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/9681/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/9681/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/terraform/statuses/fd05f9e9e8a0aab418e44fb152e426048dd632f3"}}}}
{"actor":{"display_login":"stack72"}}