{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/12294","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/12294/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/12294/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/12294/events","html_url":"https://github.com/hashicorp/terraform/issues/12294","id":210682434,"number":12294,"title":"Use list of map in module","user":{"login":"JonCubed","id":2541500,"avatar_url":"https://avatars3.githubusercontent.com/u/2541500?v=4","gravatar_id":"","url":"https://api.github.com/users/JonCubed","html_url":"https://github.com/JonCubed","followers_url":"https://api.github.com/users/JonCubed/followers","following_url":"https://api.github.com/users/JonCubed/following{/other_user}","gists_url":"https://api.github.com/users/JonCubed/gists{/gist_id}","starred_url":"https://api.github.com/users/JonCubed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JonCubed/subscriptions","organizations_url":"https://api.github.com/users/JonCubed/orgs","repos_url":"https://api.github.com/users/JonCubed/repos","events_url":"https://api.github.com/users/JonCubed/events{/privacy}","received_events_url":"https://api.github.com/users/JonCubed/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":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2017-02-28T04:14:35Z","updated_at":"2017-10-18T08:45:26Z","closed_at":null,"author_association":"NONE","body":"Not sure if this is a bug report or feature request.\r\n\r\nI would like to use `aws_dynamodb_table` in a module and pass in a list of literal attribute maps. I can pass the list of literal maps but I can't figure out how to assign it to the attribute property.\r\n\r\n**_./modules/table.tf_**\r\n```\r\nresource \"aws_dynamodb_table\" \"basic_dynamodb_table\" {\r\n    name                = \"${var.table_name}\"\r\n    read_capacity       = \"${var.read_capacity}\"\r\n    write_capacity      = \"${var.write_capacity}\"\r\n    hash_key            = \"${var.primary_key}\"\r\n\r\n    attribute {\r\n        name            = \"${var.primary_key}\"\r\n        type            = \"${var.primary_key_type}\"\r\n    }\r\n\r\n    attribute = \"${var.attribute}\"\r\n}\r\n\r\nvariable \"table_name\" {}\r\n\r\nvariable \"read_capacity\" {\r\n    default     = \"1\"\r\n}\r\n\r\nvariable \"write_capacity\" {\r\n    default     = \"1\"\r\n}\r\n\r\nvariable \"primary_key\" {}\r\n\r\nvariable \"primary_key_type\" {}\r\n\r\nvariable \"attribute\" {\r\n    default = []\r\n    description = \"List of defined attributes, map of { name, type }\"\r\n    type = \"list\"\r\n}\r\n```\r\n\r\n**_./dynamo.tf_**\r\n```\r\nmodule \"basic_table\" {\r\n    source              = \"./modules/table\"\r\n\r\n    table_name          = \"test-table\"\r\n    primary_key         = \"Id\"\r\n    primary_key_type    = \"S\"\r\n\r\n    attribute {\r\n        name = \"SecondaryId\"\r\n        type = \"S\"\r\n    }\r\n\r\n    attribute {\r\n        name = \"Type\"\r\n        type = \"N\"\r\n    }\r\n}\r\n```\r\n\r\nif I output `attribute` variable it show it as \r\n```\r\nattributes = [\r\n    {\r\n        name = SecondaryId,\r\n        type = S\r\n    },\r\n    {\r\n        name = Type,\r\n        type = N\r\n    }\r\n]\r\n```\r\n\r\nhowever when I run `terraform get ` it get `Error loading .terraform\\modules\\93790fb028cae1e6f9168662d159650c\\table.tf: Error reading config for aws_dynamodb_table[basic_dynamodb_table]: At 25:17: unknown slice type: *ast.LiteralType`\r\n\r\n**Version:**\r\nTerraform v0.8.6\r\n\r\n**OS:**\r\nWindows 10 Home (Build: 14393.693)"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/337508024","html_url":"https://github.com/hashicorp/terraform/issues/12294#issuecomment-337508024","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/12294","id":337508024,"user":{"login":"Puneeth-n","id":5619473,"avatar_url":"https://avatars1.githubusercontent.com/u/5619473?v=4","gravatar_id":"","url":"https://api.github.com/users/Puneeth-n","html_url":"https://github.com/Puneeth-n","followers_url":"https://api.github.com/users/Puneeth-n/followers","following_url":"https://api.github.com/users/Puneeth-n/following{/other_user}","gists_url":"https://api.github.com/users/Puneeth-n/gists{/gist_id}","starred_url":"https://api.github.com/users/Puneeth-n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Puneeth-n/subscriptions","organizations_url":"https://api.github.com/users/Puneeth-n/orgs","repos_url":"https://api.github.com/users/Puneeth-n/repos","events_url":"https://api.github.com/users/Puneeth-n/events{/privacy}","received_events_url":"https://api.github.com/users/Puneeth-n/received_events","type":"User","site_admin":false},"created_at":"2017-10-18T08:45:26Z","updated_at":"2017-10-18T08:45:26Z","author_association":"CONTRIBUTOR","body":"** calling the module**\r\n```\r\nmodule \"my-awesome-alb\" {\r\n    source = \"../terraform_modules/my-alb-module\"\r\n    .\r\n    .\r\n    .\r\n    listeners = [\r\n        {\r\n            port = 443\r\n            certificate = \"${data.aws_acm_certificate.wildcardDotComtravoDotCom.arn}\"\r\n        },\r\n        {\r\n            port = 444\r\n            certificate = \"${data.aws_acm_certificate.wildcardDotComtravoDotCom.arn}\"\r\n        }\r\n    ]\r\n}\r\n```\r\n\r\n** Inside the module**\r\n```\r\nresource \"aws_alb_listener\" \"listener\" {\r\n  count = \"${length(var.listeners)}\"\r\n\r\n  load_balancer_arn = \"${aws_alb.alb.arn}\"\r\n# access list via index and not via element\r\n  port              = \"${lookup(var.listeners[count.index], \"port\")}\"\r\n  protocol          = \"HTTPS\"\r\n  ssl_policy        = \"ELBSecurityPolicy-2016-08\"\r\n  certificate_arn   = \"${lookup(var.listeners[count.index], \"certificate\")}\"\r\n\r\n  default_action {\r\n    target_group_arn = \"${element(aws_alb_target_group.dummy.*.arn, count.index)}\"\r\n    type             = \"forward\"\r\n  }\r\n}\r\n\r\n```"}}
{"actor":{"display_login":"Puneeth-n"}}