From 77c8b3f04d0b764b06aa61530e09cae17d737fa1 Mon Sep 17 00:00:00 2001 From: Tung Nguyen Date: Wed, 24 Nov 2021 16:23:20 +0000 Subject: [PATCH] process terraform.tfvars file with erb, change default processing strategy back to pass --- lib/terraspace/compiler/strategy/mod.rb | 2 +- lib/terraspace/compiler/strategy/mod/tfvars.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 lib/terraspace/compiler/strategy/mod/tfvars.rb diff --git a/lib/terraspace/compiler/strategy/mod.rb b/lib/terraspace/compiler/strategy/mod.rb index 5c442b8f..683e3096 100644 --- a/lib/terraspace/compiler/strategy/mod.rb +++ b/lib/terraspace/compiler/strategy/mod.rb @@ -13,7 +13,7 @@ def strategy_class(path) return Mod::Pass if ext.empty? # infinite loop without this return Mod::Pass if Terraspace.pass_file?(path) or !text_file?(path) # Fallback to Mod::Tf for all other files. ERB useful for terraform.tfvars - "Terraspace::Compiler::Strategy::Mod::#{ext.camelize}".constantize rescue Mod::Tf + "Terraspace::Compiler::Strategy::Mod::#{ext.camelize}".constantize rescue Mod::Pass end # Thanks: https://stackoverflow.com/questions/2355866/ruby-how-to-determine-if-file-being-read-is-binary-or-text diff --git a/lib/terraspace/compiler/strategy/mod/tfvars.rb b/lib/terraspace/compiler/strategy/mod/tfvars.rb new file mode 100644 index 00000000..0bcf4f07 --- /dev/null +++ b/lib/terraspace/compiler/strategy/mod/tfvars.rb @@ -0,0 +1,4 @@ +class Terraspace::Compiler::Strategy::Mod + class Tfvars < Tf + end +end