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

feat!: type coercions for Terraform #6917

Merged
merged 2 commits into from
Jan 24, 2023

Conversation

brandonspark
Copy link
Contributor

@brandonspark brandonspark commented Jan 24, 2023

What:

This PR adds in coercions from literals of bools, ints, and floats to strings, in the matching engine.

Why:

This is how Terraform works, and it was requested by a user: #6898

How:

I added a wrapper for m_literal, which first checks if the language is hcl. If so, then it does the coercions on the necessary cases. Otherwise, it will defer to the original m_literal, now named m_literal_inner.

Test plan:

make test

Closes #6898

PR checklist:

  • Purpose of the code is evident to future readers
  • Tests included or PR comment includes a reproducible test plan
  • Documentation is up-to-date
  • A changelog entry was added to changelog.d for any user-facing change
  • Change has no security implications (otherwise, ping security team)

If you're unsure on any of this, please see:

@brandonspark brandonspark requested review from a team, mjambon and emjin and removed request for a team January 24, 2023 04:25
src/matching/Generic_vs_generic.ml Outdated Show resolved Hide resolved
src/matching/Generic_vs_generic.ml Outdated Show resolved Hide resolved
src/matching/Generic_vs_generic.ml Outdated Show resolved Hide resolved
@brandonspark brandonspark merged commit 5d7b913 into develop Jan 24, 2023
@brandonspark brandonspark deleted the brandon/terraform-type-coercions branch January 24, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Add Terraform equivalence on automatic type conversions
2 participants