{"action":"closed","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/23786","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/23786/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/23786/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/23786/events","html_url":"https://github.com/hashicorp/terraform/issues/23786","id":545441813,"node_id":"MDU6SXNzdWU1NDU0NDE4MTM=","number":23786,"title":"Register multiple instances to multiple target groups by using for_each","user":{"login":"SivaBu-kore","id":36263299,"node_id":"MDQ6VXNlcjM2MjYzMjk5","avatar_url":"https://avatars3.githubusercontent.com/u/36263299?v=4","gravatar_id":"","url":"https://api.github.com/users/SivaBu-kore","html_url":"https://github.com/SivaBu-kore","followers_url":"https://api.github.com/users/SivaBu-kore/followers","following_url":"https://api.github.com/users/SivaBu-kore/following{/other_user}","gists_url":"https://api.github.com/users/SivaBu-kore/gists{/gist_id}","starred_url":"https://api.github.com/users/SivaBu-kore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SivaBu-kore/subscriptions","organizations_url":"https://api.github.com/users/SivaBu-kore/orgs","repos_url":"https://api.github.com/users/SivaBu-kore/repos","events_url":"https://api.github.com/users/SivaBu-kore/events{/privacy}","received_events_url":"https://api.github.com/users/SivaBu-kore/received_events","type":"User","site_admin":false},"labels":[{"id":85946959,"node_id":"MDU6TGFiZWw4NTk0Njk1OQ==","url":"https://api.github.com/repos/hashicorp/terraform/labels/enhancement","name":"enhancement","color":"d4c5f9","default":true,"description":null}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2020-01-05T17:04:35Z","updated_at":"2020-01-07T02:25:50Z","closed_at":"2020-01-07T02:25:50Z","author_association":"NONE","body":"<!--\r\nHi there,\r\n\r\nThank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see: https://www.terraform.io/community.html.\r\n\r\nIf your issue relates to a specific Terraform provider, please open it in the provider's own repository. The index of providers is at https://github.com/terraform-providers .\r\n-->\r\n\r\n### Current Terraform Version\r\n```\r\n0.12.13\r\n```\r\n\r\n### Use-cases\r\nI am trying to register multiple instances to multiple target groups by using for_each.\r\nI have two variables as list values and I am trying to convert to map.\r\n\r\n### Attempted Solutions\r\n```\r\ntarget_groups = [\"target1\",\"target2\",\"target3\"]\r\ninstace_ids = [\"id1\",\"id2\"]\r\n\r\nlocals {\r\n  clusteratgs_map = flatten([\r\n    for tg, id in var.instace_ids  : [\r\n      for tg in var.target_groups  : [\r\n        format(\"%s = %s\", tg, id)\r\n               ]\r\n           ]\r\n      ])\r\n}\r\n\r\nresource \"aws_lb_target_group_attachment\" \"clustera\" {\r\n for_each = var.map_of_targets_ips \r\n  target_group_arn      = each.key\r\n  target_id             = each.value\r\n}\r\n\r\nvariable output: -\r\nmap_of_targets_ips = [\r\n \"target1 = id1\",\r\n \"target1 = id2\",\r\n \"target2 = id1\",\r\n \"target2 = id2\",\r\n \"target3 = id1\",\r\n \"target3 = id2\",\r\n]\r\n\r\nExpecting varible output:-\r\nmap_of_targets_ips = {\r\n target1 = id1\r\n target1 = id2\r\n target2 = id1\r\n target2 = id2\r\n target3 = id1\r\n target3 = id2\r\n}\r\n```\r\n### Proposal\r\nEasy sollution for Nested For loops\r\n### References\r\n<!--\r\nAre there any other GitHub issues, whether open or closed, that are related to the problem you've described above or to the suggested solution? If so, please create a list below that mentions each of them. For example:\r\n\r\n- #6017\r\n\r\n-->\r\n"}}
{"actor":{"display_login":"SivaBu-kore"}}