I have a terragrunt script which is working fine after running terragrunt apply-all command line but same thing i am not able to do/invoke form Go script. using TgApplyAll function
Below is my Go script Working terragrunt script is kept in D:\vertica-terragrunt-US-286094-Modules\with-infra location and it is working fine with manual terragrunt apply-all command but from Go script i am getting error
Getting error as below
''' github.com/gruntwork-io/terratest/modules/terraform.TgInvalidBinary.Error(...) c:/go/pkg/mod/github.com/gruntwork-io/terratest@v0.30.15/modules/terraform/errors.go:12
Detailed error func (err TgInvalidBinary) Error() string { return fmt.Sprintf("terragrunt must be set as TerraformBinary to use this function. [ TerraformBinary : %s ]", err) } '''
I used same code which i used to call terraform code from terratest Go script for calling terragrunt code also but it is not working
Can anyone help me / direct me to location like how to invoke working terragrunt code from terratest Go script ?
Hello You need to set TerraformBinary to terragrunt in the terraform options like this :
terraformOptions := &terraform.Options{
TerraformDir: "D:/vertica-terragrunt-US-286094-Modules/with-infra",
TerraformBinary : "terragrunt",
}
because the default binary is terraform and TgInvalidBinary occurs when a terragrunt function is called and the TerraformBinary is set to a value other than terragrunt.
here's a ref
https://godoc.org/github.com/gruntwork-io/terratest/modules/terraform#TgInvalidBinary
https://github.com/gruntwork-io/terratest/blob/master/modules/terraform/cmd.go