Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional_security_group_rules parameter doesn't accept a list #153

Open
basarsoker opened this issue Feb 16, 2022 · 1 comment
Open

additional_security_group_rules parameter doesn't accept a list #153

basarsoker opened this issue Feb 16, 2022 · 1 comment
Labels
bug 🐛 An issue with the system

Comments

@basarsoker
Copy link

Describe the Bug

Giving a list as a value to the additional_security_group_rules parameter causes a fail.

Expected Behavior

It should accept a list and the module should run smoothly.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Give a list as a parameter to the additional_security_group_rules parameter and run the module, such as

additional_security_group_rules  = ["20.0.0.0/24", "20.0.1.0/24"]

Error log

╷
│ Error: Invalid function argument
│ 
│   on .terraform/modules/aws_security_group/normalize.tf line 15, in locals:
│   15:     key         = coalesce(lookup(rule, "key", null), "${k}[${i}]")
│ 
│ Invalid value for "inputMap" parameter: lookup() requires a map as the
│ first argument.
╵

Environment (please complete the following information):

  • Terraform v1.1.3

Solution

Give the parameter as a list of objects, such as:


additional_security_group_rules  = [{type = "ingress", from_port = 0, to_port = 6379, protocol = "tcp", cidr_blocks =  ["20.0.0.0/24", "20.0.1.0/24"]}]

@basarsoker basarsoker added the bug 🐛 An issue with the system label Feb 16, 2022
@matejhasul
Copy link

IMHO this is not a bug. Parameter is named additional_security_group_rules which means you have to put there list of security group rules not list of CIDRs.
Works as designed (and expected).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 An issue with the system
Projects
None yet
Development

No branches or pull requests

2 participants