Skip to content

Commit

Permalink
feat: enable no color (#1293)
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkkb committed Nov 28, 2022
1 parent c2f6d8f commit 06fae23
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions infra/blueprint-test/pkg/tft/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func NewTFBlueprintTest(t testing.TB, opts ...tftOption) *TFBlueprintTest {
// load TFEnvVars from setup outputs
if tft.setupDir != "" {
tft.logger.Logf(tft.t, "Loading env vars from setup %s", tft.setupDir)
loadTFEnvVar(tft.tfEnvVars, tft.getTFOutputsAsInputs(terraform.OutputAll(tft.t, &terraform.Options{TerraformDir: tft.setupDir, Logger: tft.logger})))
loadTFEnvVar(tft.tfEnvVars, tft.getTFOutputsAsInputs(terraform.OutputAll(tft.t, &terraform.Options{TerraformDir: tft.setupDir, Logger: tft.logger, NoColor: true})))
if credsEnc, exists := tft.tfEnvVars[fmt.Sprintf("TF_VAR_%s", setupKeyOutputName)]; tft.saKey == "" && exists {
if credDec, err := b64.StdEncoding.DecodeString(credsEnc); err == nil {
gcloud.ActivateCredsAndEnvVars(tft.t, string(credDec))
Expand All @@ -241,6 +241,7 @@ func (b *TFBlueprintTest) GetTFOptions() *terraform.Options {
MigrateState: b.migrateState,
PlanFilePath: b.planFilePath,
RetryableTerraformErrors: b.retryableTerraformErrors,
NoColor: true,
})
if b.maxRetries > 0 {
newOptions.MaxRetries = b.maxRetries
Expand Down Expand Up @@ -294,7 +295,7 @@ func (b *TFBlueprintTest) GetTFSetupOutputListVal(key string) []string {
if b.setupDir == "" {
b.t.Fatal("Setup path not set")
}
return terraform.OutputList(b.t, &terraform.Options{TerraformDir: b.setupDir, Logger: b.logger}, key)
return terraform.OutputList(b.t, &terraform.Options{TerraformDir: b.setupDir, Logger: b.logger, NoColor: true}, key)
}

// GetTFSetupStringOutput returns TF setup output for a given key as string.
Expand All @@ -303,7 +304,7 @@ func (b *TFBlueprintTest) GetTFSetupStringOutput(key string) string {
if b.setupDir == "" {
b.t.Fatal("Setup path not set")
}
return terraform.Output(b.t, &terraform.Options{TerraformDir: b.setupDir, Logger: b.logger}, key)
return terraform.Output(b.t, &terraform.Options{TerraformDir: b.setupDir, Logger: b.logger, NoColor: true}, key)
}

// loadTFEnvVar adds new env variables prefixed with TF_VAR_ to an existing map of variables.
Expand Down Expand Up @@ -376,6 +377,7 @@ func (b *TFBlueprintTest) DefaultInit(assert *assert.Assertions) {
terraform.Validate(b.t, terraform.WithDefaultRetryableErrors(b.t, &terraform.Options{
TerraformDir: b.tfDir,
Logger: b.logger,
NoColor: true,
}))
}

Expand Down

0 comments on commit 06fae23

Please sign in to comment.