Skip to content

Commit

Permalink
fix: remove linebreaks from azure cli output
Browse files Browse the repository at this point in the history
  • Loading branch information
huf1 authored and DenisBiondic committed May 30, 2022
1 parent 0b04ced commit b71ea4d
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/recipes/terraform/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/sirupsen/logrus"
"os"
"path/filepath"
"strings"
)

// Terraform is a wrapper around common terraform functionality used in IaC projects with Azure. In includes remote state
Expand Down Expand Up @@ -132,6 +133,8 @@ func (tf *terraformWrapper) Init() error {
return internal.ReturnErrorOrPanic(err)
}

storageAccountKey = trimLinebreakSuffixes(storageAccountKey)

logrus.Info("Creating the remote state blob container named " + tf.storageSettings.BlobContainerName + "...")
_, err = tf.executor.Execute("az storage container create" +
" --account-name " + tf.stateStorageAccountName +
Expand Down Expand Up @@ -376,3 +379,7 @@ func (tf *terraformWrapper) forceApply(isDestroy bool) error {

return nil
}

func trimLinebreakSuffixes(storageAccountKey string) string {
return strings.TrimRight(storageAccountKey, "\r\n")
}

0 comments on commit b71ea4d

Please sign in to comment.