Skip to content

Commit

Permalink
update outputs to only save terraform output value
Browse files Browse the repository at this point in the history
Before this change, outputs were saving as the terraform output json data. Instead, just the value is added to output which makes the tfo outputs directly consumable by other pods.

Fixes: #96
  • Loading branch information
isaaguilar committed Jun 7, 2022
1 parent 93b69fe commit d54f9ae
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/terraform_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,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-v5beta2"
terraformRunner := "isaaguilar/tf-runner-v5beta3"
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-v5beta2"
TF_RUNNER_IMAGE_NAME="tf-runner-v5beta3"
printf "\n\n----------------\nFetching available hashicorp/terraform versions"
i=0
BUILT_TF_RUNNER_IMAGES=($(
Expand Down
2 changes: 1 addition & 1 deletion terraform-runner/tf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ if [[ "$TFO_RUNNER" == "apply" ]] && [[ "$TFO_SAVE_OUTPUTS" == "true" ]]; then
echo "Omitting $key"
continue
fi
b64value=$(jq -r --arg key $key '.[$key]' <<< $jsonoutput|base64|tr -d '[:space:]')
b64value=$(jq -r --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"
Expand Down

0 comments on commit d54f9ae

Please sign in to comment.