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

fix: Wrap local.configmap_roles.groups with tolist() to avoid panic #846

Merged
merged 4 commits into from
Apr 23, 2020

Conversation

keznikl
Copy link
Contributor

@keznikl keznikl commented Apr 23, 2020

Description

Wrap local.configmap_roles.groups with tolist() in order to avoid golang panic.

Without this change we get the following on Terraform v0.12.24:

panic: inconsistent list element types (cty.Object(map[string]cty.Type{"groups":cty.DynamicPseudoType, "rolearn":cty.String, "username":cty.String}) then cty.Object(map[string]cty.Type{"groups":cty.Tuple([]cty.Type{cty.String, cty.String}), "rolearn":cty.String, "username":cty.String}))

It is caused by the ternary operator ( X ? Y : Z) in conjunction with distinct();
tolist(...) resolves the type and thus the issue .

Checklist

keznikl added 2 commits April 23, 2020 15:42
…ang panic.

Wrap local.configmap_roles.groups with tolist() in order to avoid golang panic.

Without this I get the following:

```
panic: inconsistent list element types (cty.Object(map[string]cty.Type{"groups":cty.DynamicPseudoType, "rolearn":cty.String, "username":cty.String}) then cty.Object(map[string]cty.Type{"groups":cty.Tuple([]cty.Type{cty.String, cty.String}), "rolearn":cty.String, "username":cty.String}))
```

It is caused by the ternary operator ( X ? Y : Z) in conjunction with distinct().
tolist(...) resolves the type.
aws_auth.tf Show resolved Hide resolved
@keznikl keznikl marked this pull request as ready for review April 23, 2020 14:27
Copy link
Member

@barryib barryib left a comment

Choose a reason for hiding this comment

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

Thanks @keznikl . Nice catch.

@barryib barryib merged commit 36d1b5a into terraform-aws-modules:master Apr 23, 2020
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants