Skip to content

Return an error for invalid for expressions with marks#433

Merged
pselle merged 1 commit intohcl2from
pselle/marked-for
Dec 17, 2020
Merged

Return an error for invalid for expressions with marks#433
pselle merged 1 commit intohcl2from
pselle/marked-for

Conversation

@pselle
Copy link
Copy Markdown
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.

@pselle pselle requested a review from a team December 15, 2020 19:43
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