{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/3449","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/3449/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/3449/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/3449/events","html_url":"https://github.com/hashicorp/terraform/issues/3449","id":110429474,"number":3449,"title":"Using element with splat reference should scope dependency to selected resource","user":{"login":"kklipsch","id":673953,"avatar_url":"https://avatars.githubusercontent.com/u/673953?v=3","gravatar_id":"","url":"https://api.github.com/users/kklipsch","html_url":"https://github.com/kklipsch","followers_url":"https://api.github.com/users/kklipsch/followers","following_url":"https://api.github.com/users/kklipsch/following{/other_user}","gists_url":"https://api.github.com/users/kklipsch/gists{/gist_id}","starred_url":"https://api.github.com/users/kklipsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kklipsch/subscriptions","organizations_url":"https://api.github.com/users/kklipsch/orgs","repos_url":"https://api.github.com/users/kklipsch/repos","events_url":"https://api.github.com/users/kklipsch/events{/privacy}","received_events_url":"https://api.github.com/users/kklipsch/received_events","type":"User","site_admin":false},"labels":[{"id":85946957,"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7","default":true},{"id":127939292,"url":"https://api.github.com/repos/hashicorp/terraform/labels/core","name":"core","color":"cccccc","default":false}],"state":"open","locked":false,"assignee":{"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},"assignees":[{"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}],"milestone":null,"comments":51,"created_at":"2015-10-08T11:35:39Z","updated_at":"2016-12-12T14:11:41Z","closed_at":null,"body":"I'm trying to setup a multi-node cluster with attached ebs volumes.  An example below:\n\n```\nresource \"aws_instance\" \"nodes\" {\n    instance_type = \"${var.model}\"\n    key_name = \"${var.ec2_keypair}\"\n    ami = \"${lookup(var.zk_amis, var.region)}\"\n    count = \"${var.node_count}\"\n    vpc_security_group_ids = [\"${aws_security_group.default.id}\"]\n    subnet_id = \"${lookup(var.subnet_ids, element(keys(var.subnet_ids), count.index))}\"\n    associate_public_ip_address = true\n    user_data = \"${file(\"cloud_init\")}\"\n    tags {\n        Name = \"${var.cluster_name}-${count.index}\"\n    }\n}\n\nresource \"aws_ebs_volume\" \"node-ebs\" {\n    count = \"${var.node-count}\"\n    availability_zone = \"${element(keys(var.subnet_ids), count.index)}\"\n    size = 100\n    tags {\n        Name = \"${var.cluster_name}-ebs-${count.index}\"\n    }\n}\n\nresource \"aws_volume_attachment\" \"node-attach\" {\n    count = \"${var.node_count}\"\n    device_name = \"/dev/xvdh\"\n    volume_id = \"${element(aws_ebs_volume.node-ebs.*.id, count.index)}\"\n    instance_id = \"${element(aws_instance.nodes.*.id, count.index)}\"\n}\n```\n\nIf a change happens to a single node (for instance if a single ec2 instance is terminated) ALL of the aws_volume_attachments are recreated.  \n\nClearly we would not want volume attachments to be removed in a production environment.  Worse than that, in conjunction with #2957 you first must unmount these attachments before they can be recreated.  This has the effect of making volume attachments only viable on brand new clusters.\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/266440191","html_url":"https://github.com/hashicorp/terraform/issues/3449#issuecomment-266440191","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/3449","id":266440191,"user":{"login":"jbardin","id":35067,"avatar_url":"https://avatars.githubusercontent.com/u/35067?v=3","gravatar_id":"","url":"https://api.github.com/users/jbardin","html_url":"https://github.com/jbardin","followers_url":"https://api.github.com/users/jbardin/followers","following_url":"https://api.github.com/users/jbardin/following{/other_user}","gists_url":"https://api.github.com/users/jbardin/gists{/gist_id}","starred_url":"https://api.github.com/users/jbardin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbardin/subscriptions","organizations_url":"https://api.github.com/users/jbardin/orgs","repos_url":"https://api.github.com/users/jbardin/repos","events_url":"https://api.github.com/users/jbardin/events{/privacy}","received_events_url":"https://api.github.com/users/jbardin/received_events","type":"User","site_admin":false},"created_at":"2016-12-12T14:11:41Z","updated_at":"2016-12-12T14:11:41Z","body":"@sigmunau,\r\n\r\nYes, it's the same behavior with direct indexing as well. While it might be a little easier to calculate which node is referenced with the index operation, we still need to add a way to get at this reference when building the graph. "}}
{"actor":{"display_login":"jbardin"}}