From f59882041ec8de7b546248f4c43708e99b16937a Mon Sep 17 00:00:00 2001 From: Somesh Koli Date: Thu, 10 Nov 2022 20:00:54 +0530 Subject: [PATCH] Increase precedence of variable supplied by -var over -var-file Currenty terraform decides prcedence of variable based on their order. Having -var at higher precedence allows us to edit some of the variables quickly for testing etc. --- modules/terraform/format.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/terraform/format.go b/modules/terraform/format.go index f50072d7c..40c2d1f95 100644 --- a/modules/terraform/format.go +++ b/modules/terraform/format.go @@ -56,8 +56,8 @@ func FormatArgs(options *Options, args ...string) []string { terraformArgs = append(terraformArgs, args...) if includeVars { - terraformArgs = append(terraformArgs, FormatTerraformVarsAsArgs(options.Vars)...) terraformArgs = append(terraformArgs, FormatTerraformArgs("-var-file", options.VarFiles)...) + terraformArgs = append(terraformArgs, FormatTerraformVarsAsArgs(options.Vars)...) } terraformArgs = append(terraformArgs, FormatTerraformArgs("-target", options.Targets)...)