levmel / terraform-multidecoder-yaml_json

Access multi JSON and/or YAML files with their relative paths in one step.
MIT License
15 stars 4 forks source link

Key of the filenames are garbled #13

Closed arun-a-nayagam closed 2 years ago

arun-a-nayagam commented 2 years ago

Hi @levmel Found a strange issue, when using filenames like acp_platinum.yaml and acp_longnam.yaml [note not longname, intentionally misspelt as longnam.yaml] key for acp_platinum.yaml becomes acp_platinu key for acp_longnam.yaml becomes acp_alongn

I think it's to do with how the trim function works, I tested it with trimsuffix and that seems to solve the issue. Perhaps you might want to test and update the code.

Thanks, Arun

arun-a-nayagam commented 2 years ago

Also, just realised, trimsuffix can not work with ".yaml .json" perhaps that support for .json needs rethinking if trimsuffix is used

levmel commented 2 years ago

Hi @arun-a-nayagam,

it's fixed now in v0.2.1. Thank you for the hint!

Best Regards, Levon

arun-a-nayagam commented 2 years ago

Hi @levmel

data "local_file" "yaml" { and this for i, file in data.local_file.yaml_json_standard doesn't seem to match?

Thanks, Arun

levmel commented 2 years ago

Hi @arun-a-nayagam,

now it should be good in v0.2.1.

Regards,

Levon