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

fallbackToRawString issue #124

Closed
piggybankwang opened this issue Jul 8, 2024 · 1 comment
Closed

fallbackToRawString issue #124

piggybankwang opened this issue Jul 8, 2024 · 1 comment

Comments

@piggybankwang
Copy link
Contributor

not fully understand why when fallbackToRawString == true
you still throw errors #107
then how do we read rawtring properly, we are currently handler error from the caller

@ryan-ph
Copy link
Member

ryan-ph commented Jul 16, 2024

@piggybankwang sorry for the late reply.

We return still return the error because it signals that fallback has actually occurred and the caller should treat it as a raw value. hcledit provides the RawVal as a way to distinguish between raw value vs. a normal cty value (normal meaning that the actual value can be read without fallback).

If you know for sure that the value you are reading needs to fallback to the raw string, you can ignore the error. If you are unsure if the value you are reading needs to fallback, you can check if the error is nil and determine if you need to handle it as a raw string or now.

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

No branches or pull requests

2 participants