Skip to content

Commit

Permalink
remove newlines from outputs
Browse files Browse the repository at this point in the history
`jq` adds a newline when using the `-r` flag. Switched to the `-j` flag which removes the newline.
  • Loading branch information
isaaguilar committed Jun 14, 2022
1 parent 669eba7 commit a83e142
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/terraform_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func newRunOptions(tf *tfv1alpha1.Terraform) RunOptions {
tfName := tf.Name
name := tf.Status.PodNamePrefix
versionedName := name + "-v" + fmt.Sprint(tf.Generation)
terraformRunner := "isaaguilar/tf-runner-v5beta3"
terraformRunner := "isaaguilar/tf-runner-v5beta4"
terraformRunnerPullPolicy := corev1.PullIfNotPresent
terraformVersion := "1.1.9"

Expand Down
2 changes: 1 addition & 1 deletion terraform-runner/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ done
##
## Build tf-runner(s)
##
TF_RUNNER_IMAGE_NAME="tf-runner-v5beta3"
TF_RUNNER_IMAGE_NAME="tf-runner-v5beta4"
printf "\n\n----------------\nFetching available hashicorp/terraform versions"
i=0
BUILT_TF_RUNNER_IMAGES=($(
Expand Down
4 changes: 2 additions & 2 deletions terraform-runner/tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ if [[ "$TFO_RUNNER" == "apply" ]] && [[ "$TFO_SAVE_OUTPUTS" == "true" ]]; then
echo "Omitting $key"
continue
fi
b64value=$(jq -r --arg key $key '.[$key].value' <<< $jsonoutput|base64|tr -d '[:space:]')
b64value=$(jq -j --arg key $key '.[$key].value' <<< $jsonoutput|base64|tr -d '[:space:]')
jq -Mc --arg key $key --arg value $b64value '. += [
{"op":"add","path":"/data/\($key)","value":"\($value)"}
]' "$data" > "$t"
cp "$t" "$data"
done
kubectl patch secret "$TFO_OUTPUTS_SECRET_NAME" --type json --patch-file "$data"
fi
fi

0 comments on commit a83e142

Please sign in to comment.