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

Return an error for invalid for expressions with marks #433

Merged
merged 1 commit into from
Dec 17, 2020

Conversation

pselle
Copy link
Contributor

@pselle pselle commented Dec 15, 2020

Rather than allowing a panic to occur, return an error for "Invalid object key" if a user attempts to write a for expression that would convert the marked value to an unmarked string (by using it as the object key).

Prior to this change, the following code would panic:

> local.baz
{
  "a" = (sensitive)
  "b" = "dog"
}
> {for  v in local.baz: v => 1 }

After:

> {for  v in local.baz: v => 1 }

>  
Error: Invalid object key

  on <console-input> line 1:
  (source code not available) # Terraform console usage

Marked values cannot be used as object keys.

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