{"action":"created","comment":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/77956311","id":77956311,"diff_hunk":"@@ -0,0 +1,24 @@\n+variable \"count\" {\n+    default = 2\n+}\n+\n+resource \"aws_instance\" \"foo\" {\n+    count = \"${var.count}\"\n+    foo = \"foo\"\n+}\n+\n+resource \"aws_instance\" \"bar\" {\n+    count = \"${var.count}\"\n+    foo = \"${element(aws_instance.foo.*.foo,count.index)}-bar\"","path":"terraform/test-fixtures/plan-count-inc-index-list/main.tf","position":12,"original_position":12,"commit_id":"8049722f7485580f3347a6a603ab023d6ed45391","original_commit_id":"150f3afea8b5fa692a930e05e38b52f420d93ee4","user":{"login":"maxenglander","id":340318,"avatar_url":"https://avatars.githubusercontent.com/u/340318?v=3","gravatar_id":"","url":"https://api.github.com/users/maxenglander","html_url":"https://github.com/maxenglander","followers_url":"https://api.github.com/users/maxenglander/followers","following_url":"https://api.github.com/users/maxenglander/following{/other_user}","gists_url":"https://api.github.com/users/maxenglander/gists{/gist_id}","starred_url":"https://api.github.com/users/maxenglander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxenglander/subscriptions","organizations_url":"https://api.github.com/users/maxenglander/orgs","repos_url":"https://api.github.com/users/maxenglander/repos","events_url":"https://api.github.com/users/maxenglander/events{/privacy}","received_events_url":"https://api.github.com/users/maxenglander/received_events","type":"User","site_admin":false},"body":"Now that I've looked through the code a bit, naturally this makes sense: none of the `foo` attributes in `aws_instance.foo` are computed, and all are known. ","created_at":"2016-09-08T07:18:32Z","updated_at":"2016-09-08T07:18:32Z","html_url":"https://github.com/hashicorp/terraform/pull/8595#discussion_r77956311","pull_request_url":"https://api.github.com/repos/hashicorp/terraform/pulls/8595","_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments/77956311"},"html":{"href":"https://github.com/hashicorp/terraform/pull/8595#discussion_r77956311"},"pull_request":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/8595"}}},"pull_request":{"url":"https://api.github.com/repos/hashicorp/terraform/pulls/8595","id":83576158,"html_url":"https://github.com/hashicorp/terraform/pull/8595","diff_url":"https://github.com/hashicorp/terraform/pull/8595.diff","patch_url":"https://github.com/hashicorp/terraform/pull/8595.patch","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/8595","number":8595,"state":"open","locked":false,"title":"#3449 Scope dependency to selected resource when indexing splat reference","user":{"login":"maxenglander","id":340318,"avatar_url":"https://avatars.githubusercontent.com/u/340318?v=3","gravatar_id":"","url":"https://api.github.com/users/maxenglander","html_url":"https://github.com/maxenglander","followers_url":"https://api.github.com/users/maxenglander/followers","following_url":"https://api.github.com/users/maxenglander/following{/other_user}","gists_url":"https://api.github.com/users/maxenglander/gists{/gist_id}","starred_url":"https://api.github.com/users/maxenglander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxenglander/subscriptions","organizations_url":"https://api.github.com/users/maxenglander/orgs","repos_url":"https://api.github.com/users/maxenglander/repos","events_url":"https://api.github.com/users/maxenglander/events{/privacy}","received_events_url":"https://api.github.com/users/maxenglander/received_events","type":"User","site_admin":false},"body":"EDIT: I've also submitted a fix which produces the expected output when using the new syntax `${list[idx]}`, but does not yet fix the issue when using the old syntax `${element(list,idx)}`.\r\n\r\nAs per @mitchellh advice on #3449, this is an attempt to add a test that reproduces the bug on v0.6. Mitchell advised creating a test for context_apply_test.go, but I started with context_plan_test.go since that seemed like a good place to test as well. Will add a test to context_apply_test.go if this isn't sufficient.\r\n\r\nI tested this on both 0.6.9 and master - fails on both.\r\n\r\nThe output we desire is\r\n\r\n    DIFF:\r\n\r\n    CREATE: aws_ebs_volume.1\r\n       foo: \"\" => \"foo\"\r\n       type: \"\" => \"aws_ebs_volume\"\r\n    CREATE: aws_instance.bar.1\r\n      foo: \"\" => \"foo\"\r\n      type: \"\" => \"aws_instance\"\r\n    CREATE: aws_instance.bar.1\r\n      foo:  \"\" => \"foo-bar\"\r\n      type: \"\" => \"aws_instance\"\r\n    CREATE: aws_instance.foo.1\r\n      foo:  \"\" => \"foo\"\r\n      type: \"\" => \"aws_instance\"\r\n    CREATE: aws_volume_attachment.foo.1\r\n      foo: \"\" => \"foo\"\r\n      instance_id: \"\" => \"bar\"\r\n      type: \"\" => \"aws_volume_attachment\"\r\n      volume_id: \"\" => \"bar\"\r\n   \r\n    STATE:\r\n   \r\n    aws_ebs_volume.0:\r\n      ID = foo\r\n      type = aws_ebs_volume\r\n    aws_instance.bar.0:\r\n      ID = foo-bar\r\n      foo = foo\r\n      type = aws_instance\r\n    aws_instance.foo.0:\r\n      ID = bar\r\n      foo = foo\r\n      type = aws_instance\r\n    aws_volume_attachment.foo.0:\r\n      ID = bar\r\n      foo = foo\r\n      instance_id = bar\r\n      type = aws_volume_attachment\r\n      volume_id = bar\r\n\r\nBut the test fails (as expected) with\r\n\r\n    DIFF:\r\n   \r\n    CREATE: aws_ebs_volume.foo.1\r\n      foo:  \"\" => \"foo\"\r\n      type: \"\" => \"aws_ebs_volume\"\r\n    CREATE: aws_instance.bar.1\r\n      foo:  \"\" => \"foo-bar\"\r\n      type: \"\" => \"aws_instance\"\r\n    CREATE: aws_instance.foo.1\r\n      foo:  \"\" => \"foo\"\r\n      type: \"\" => \"aws_instance\"\r\n    UPDATE: aws_volume_attachment.foo.0\r\n       instance_id: \"\" => \"<computed>\"\r\n       type:        \"\" => \"aws_volume_attachment\"\r\n      volume_id:   \"\" => \"<computed>\"\r\n    CREATE: aws_volume_attachment.foo.1\r\n      instance_id: \"\" => \"<computed>\"\r\n      type:        \"\" => \"aws_volume_attachment\"\r\n      volume_id:   \"\" => \"<computed>\"\r\n    \r\n    STATE:\r\n    \r\n    aws_ebs_volume.foo.0:\r\n      ID = bar\r\n      foo = foo\r\n      type = aws_ebs_volume\r\n    aws_instance.bar.0:\r\n      ID = bar\r\n      foo = foo-bar\r\n      type = aws_instance\r\n    aws_instance.foo.0:\r\n      ID = bar\r\n      foo = foo\r\n      type = aws_instance\r\n    aws_volume_attachment.foo.0:\r\n      ID = bar\r\n      foo = foo\r\n      instance_id = bar\r\n      type = aws_volume_attachment\r\n      volume_id = bar\r\n\r\nInterestingly, `aws_instance.bar.0` is _not_ marked for update even though it is using the same `${element(<splat>, <index>)}` syntax as `aws_volume_attachment.foo`.","created_at":"2016-09-01T06:19:18Z","updated_at":"2016-09-08T07:18:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7267fbf04c1245aed7816af170f9fdb70e3a3870","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hashicorp/terraform/pulls/8595/commits","review_comments_url":"https://api.github.com/repos/hashicorp/terraform/pulls/8595/comments","review_comment_url":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/8595/comments","statuses_url":"https://api.github.com/repos/hashicorp/terraform/statuses/8049722f7485580f3347a6a603ab023d6ed45391","head":{"label":"maxenglander:gh-3449-plan-count-inc-with-list-index-test","ref":"gh-3449-plan-count-inc-with-list-index-test","sha":"8049722f7485580f3347a6a603ab023d6ed45391","user":{"login":"maxenglander","id":340318,"avatar_url":"https://avatars.githubusercontent.com/u/340318?v=3","gravatar_id":"","url":"https://api.github.com/users/maxenglander","html_url":"https://github.com/maxenglander","followers_url":"https://api.github.com/users/maxenglander/followers","following_url":"https://api.github.com/users/maxenglander/following{/other_user}","gists_url":"https://api.github.com/users/maxenglander/gists{/gist_id}","starred_url":"https://api.github.com/users/maxenglander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxenglander/subscriptions","organizations_url":"https://api.github.com/users/maxenglander/orgs","repos_url":"https://api.github.com/users/maxenglander/repos","events_url":"https://api.github.com/users/maxenglander/events{/privacy}","received_events_url":"https://api.github.com/users/maxenglander/received_events","type":"User","site_admin":false},"repo":{"id":36055241,"name":"terraform","full_name":"maxenglander/terraform","owner":{"login":"maxenglander","id":340318,"avatar_url":"https://avatars.githubusercontent.com/u/340318?v=3","gravatar_id":"","url":"https://api.github.com/users/maxenglander","html_url":"https://github.com/maxenglander","followers_url":"https://api.github.com/users/maxenglander/followers","following_url":"https://api.github.com/users/maxenglander/following{/other_user}","gists_url":"https://api.github.com/users/maxenglander/gists{/gist_id}","starred_url":"https://api.github.com/users/maxenglander/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxenglander/subscriptions","organizations_url":"https://api.github.com/users/maxenglander/orgs","repos_url":"https://api.github.com/users/maxenglander/repos","events_url":"https://api.github.com/users/maxenglander/events{/privacy}","received_events_url":"https://api.github.com/users/maxenglander/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/maxenglander/terraform","description":"Terraform is a tool for building, changing, and combining infrastructure safely and efficiently.","fork":true,"url":"https://api.github.com/repos/maxenglander/terraform","forks_url":"https://api.github.com/repos/maxenglander/terraform/forks","keys_url":"https://api.github.com/repos/maxenglander/terraform/keys{/key_id}","collaborators_url":"https://api.github.com/repos/maxenglander/terraform/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/maxenglander/terraform/teams","hooks_url":"https://api.github.com/repos/maxenglander/terraform/hooks","issue_events_url":"https://api.github.com/repos/maxenglander/terraform/issues/events{/number}","events_url":"https://api.github.com/repos/maxenglander/terraform/events","assignees_url":"https://api.github.com/repos/maxenglander/terraform/assignees{/user}","branches_url":"https://api.github.com/repos/maxenglander/terraform/branches{/branch}","tags_url":"https://api.github.com/repos/maxenglander/terraform/tags","blobs_url":"https://api.github.com/repos/maxenglander/terraform/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/maxenglander/terraform/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/maxenglander/terraform/git/refs{/sha}","trees_url":"https://api.github.com/repos/maxenglander/terraform/git/trees{/sha}","statuses_url":"https://api.github.com/repos/maxenglander/terraform/statuses/{sha}","languages_url":"https://api.github.com/repos/maxenglander/terraform/languages","stargazers_url":"https://api.github.com/repos/maxenglander/terraform/stargazers","contributors_url":"https://api.github.com/repos/maxenglander/terraform/contributors","subscribers_url":"https://api.github.com/repos/maxenglander/terraform/subscribers","subscription_url":"https://api.github.com/repos/maxenglander/terraform/subscription","commits_url":"https://api.github.com/repos/maxenglander/terraform/commits{/sha}","git_commits_url":"https://api.github.com/repos/maxenglander/terraform/git/commits{/sha}","comments_url":"https://api.github.com/repos/maxenglander/terraform/comments{/number}","issue_comment_url":"https://api.github.com/repos/maxenglander/terraform/issues/comments{/number}","contents_url":"https://api.github.com/repos/maxenglander/terraform/contents/{+path}","compare_url":"https://api.github.com/repos/maxenglander/terraform/compare/{base}...{head}","merges_url":"https://api.github.com/repos/maxenglander/terraform/merges","archive_url":"https://api.github.com/repos/maxenglander/terraform/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/maxenglander/terraform/downloads","issues_url":"https://api.github.com/repos/maxenglander/terraform/issues{/number}","pulls_url":"https://api.github.com/repos/maxenglander/terraform/pulls{/number}","milestones_url":"https://api.github.com/repos/maxenglander/terraform/milestones{/number}","notifications_url":"https://api.github.com/repos/maxenglander/terraform/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/maxenglander/terraform/labels{/name}","releases_url":"https://api.github.com/repos/maxenglander/terraform/releases{/id}","deployments_url":"https://api.github.com/repos/maxenglander/terraform/deployments","created_at":"2015-05-22T06:05:58Z","updated_at":"2016-01-24T05:48:06Z","pushed_at":"2016-09-08T06:59:37Z","git_url":"git://github.com/maxenglander/terraform.git","ssh_url":"git@github.com:maxenglander/terraform.git","clone_url":"https://github.com/maxenglander/terraform.git","svn_url":"https://github.com/maxenglander/terraform","homepage":"http://www.terraform.io","size":53586,"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":"92a9a7c8b88c8627b926a523051e01499fa88bfc","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-09-08T04:59:39Z","pushed_at":"2016-09-08T07:12:09Z","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":120698,"stargazers_count":5634,"watchers_count":5634,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1849,"mirror_url":null,"open_issues_count":1506,"forks":1849,"open_issues":1506,"watchers":5634,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/8595"},"html":{"href":"https://github.com/hashicorp/terraform/pull/8595"},"issue":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/8595"},"comments":{"href":"https://api.github.com/repos/hashicorp/terraform/issues/8595/comments"},"review_comments":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/8595/comments"},"review_comment":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hashicorp/terraform/pulls/8595/commits"},"statuses":{"href":"https://api.github.com/repos/hashicorp/terraform/statuses/8049722f7485580f3347a6a603ab023d6ed45391"}}}}
{"actor":{"display_login":"maxenglander"}}