You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a plan contains UTF-8 characters, perhaps in a description field for a variable, this causes an error on Windows of the form: 'charmap' codec can't decode byte 0x9d in position 99999: character maps to <undefined>.
To Reproduce
Have a variable with a utf-8 specific character such
variable"my_var" {
description="My weird characters: “Java” or “Windows”"default=null
}
terraform-compliance -p plan.out -f rules
Running using python package
ERROR: C:\Users\...\plan.out.json is not a valid JSON file.
Did you try to convert the binary plan file to json with "terraform show -json C:\Users\...\plan.out.json > C:\Users\...\plan.out.json.json" ?
Expected behavior :
It doesn't crash with an error!
Tested versions :
terraform-compliance version v1.0.56
terraform version v0.12.15
python version 3.7.3
Additional context
Adding 'encoding="utf8"' to the various open calls fixes it - ie open(values, 'r', encoding='utf8') although not sure what impact this has on other versions of Python. For now the workaround is to only run this in CI & stop people adding utf8 characters to modules.
The text was updated successfully, but these errors were encountered:
Description :
On windows the default system encoding is cp1252
as opposed to my RHEL system where:
When a plan contains UTF-8 characters, perhaps in a description field for a variable, this causes an error on Windows of the form:
'charmap' codec can't decode byte 0x9d in position 99999: character maps to <undefined>
.To Reproduce
terraform-compliance -p plan.out -f rules
Expected behavior :
It doesn't crash with an error!
Tested versions :
Additional context
Adding 'encoding="utf8"' to the various open calls fixes it - ie open(values, 'r', encoding='utf8') although not sure what impact this has on other versions of Python. For now the workaround is to only run this in CI & stop people adding utf8 characters to modules.
The text was updated successfully, but these errors were encountered: