Call expansion helper from within hook

Is it possible to call the expansion helper from within a hook?

I would like to be able to evaluate the BUILD_DIR variable from within a hook. I tried:

puts "BUILD_DIR = #{expansion('BUILD_DIR')}"

But that throws the error:

/home/tom/code/my-project/config/boot.rb:21:in `<top (required)>': undefined method `expansion' for main:Object (NoMethodError)

The reason I want to do this is so I can add files to the generated terraform using the boot hook.

From further reading it looks like I want to call expansion on the variable