boltops-tools / terraspace

Terraspace: The Terraform Framework
https://terraspace.cloud
Apache License 2.0
678 stars 46 forks source link

fix expansion for the case of ENV var is not set #299

Closed pvshewale closed 1 year ago

pvshewale commented 1 year ago

This is a 🐞 bug fix.

Summary

As per docs, with Terraspace v2, any environment variable is also available in the expansion helper. IE: MY_VAR=foo can be use in the expansion(":MY_VAR") method. This works as expected if MY_VAR is set to some value, but in case environment variable MY_VAR is not set it's returning as it is in non-expanded state like ":MY_VAR" Now with this fix, it returns empty space if environment variable is not set. Unit test case is also updated.

Context

How to Test

Just run the unit test

rspec spec/terraspace/provider/expander/generic_spec.rb

Version Changes

tongueroo commented 1 year ago

Thanks 👍 Released in 2.2.4

pvshewale commented 1 year ago

Thanks 👍