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

modules/worker_groups: Fix security group index error when var.create_eks is false #3

Merged

Conversation

chancez
Copy link
Contributor

@chancez chancez commented Mar 19, 2020

Previously this error could occur when var.create_eks was false:

Error: Invalid index

  on ../../../modules/eks-worker-groups/locals.tf line 83, in locals:
  83:   worker_security_group_id = var.worker_create_security_group ? aws_security_group.worker_groups.0.id : var.worker_security_group_id
    |----------------
    | aws_security_group.worker_groups is empty tuple

The given key does not identify an element in this collection value.

Previously this error could occur when var.create_eks was false:

```
Error: Invalid index

  on ../../../modules/eks-worker-groups/locals.tf line 83, in locals:
  83:   worker_security_group_id = var.worker_create_security_group ? aws_security_group.worker_groups.0.id : var.worker_security_group_id
    |----------------
    | aws_security_group.worker_groups is empty tuple

The given key does not identify an element in this collection value.
```
Copy link
Contributor

@js-timbirkett js-timbirkett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a nice pattern for all the var.thing && var.create_eks that goes on in this module.

Thanks for the PR!

@js-timbirkett js-timbirkett merged commit c1ae5c1 into devopsmakers:master Mar 19, 2020
@chancez
Copy link
Contributor Author

chancez commented Mar 19, 2020

@js-timbirkett Yeah, I was contemplating doing this for the other cases that are similar too, but decided to leave that for later as a follow up to avoid making too many changes at once.

@chancez chancez deleted the fix_security_group_index_error branch March 19, 2020 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants