Open
Description
Found a bug? Maybe our Slack Community can help.
Describe the Bug
When omitting private_ips var the execution ends whit the rollowing error:
Releasing state lock. This may take a few moments...
╷
│ Error: expected private_ip to contain a valid IPv4 address, got:
│
│ with module.sherpa.module.ec2_instance_group[1].aws_instance.default[0],
│ on ../../modules/aws/ec2_group/main.tf line 97, in resource "aws_instance" "default":
│ 97: private_ip = concat(var.private_ips, [""])[min(length(var.private_ips), count.index)]
│
╵
╷
│ Error: expected private_ip to contain a valid IPv4 address, got:
│
│ with module.sherpa.module.ec2_instance_group[0].aws_instance.default[0],
│ on ../../modules/aws/ec2_group/main.tf line 97, in resource "aws_instance" "default":
│ 97: private_ip = concat(var.private_ips, [""])[min(length(var.private_ips), count.index)]
│
Expected Behavior
As per documentation in README.md, the parameter shouldn't be mandatory.
Steps to Reproduce
Omit it in the ec2_group module declaration.
Screenshots
If applicable, add screenshots or logs to help explain your problem.
Environment (please complete the following information):
Anything that will help us triage the bug will help. Here are some ideas:
- OS: Ubuntu
- Version: 20.04
Additional Context
Could be easily solved by introducing a check in the aws_instance resource, in main.tf, at line 97.
e.g.: private_ip = length(var.private_ips) > 0 ? concat(var.private_ips, [""])[min(length(var.private_ips), count.index)] : null