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

Omitting private_ips variable result in terraform error. #41

Open
riccardomassullo opened this issue Mar 11, 2022 · 1 comment
Open
Labels
bug 🐛 An issue with the system

Comments

@riccardomassullo
Copy link

Found a bug? Maybe our Slack Community can help.

Slack Community

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

@riccardomassullo riccardomassullo added the bug 🐛 An issue with the system label Mar 11, 2022
@noqqe
Copy link

noqqe commented Jan 19, 2023

Same issue here, module is effectively not usable at the moment

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

Successfully merging a pull request may close this issue.

2 participants