Skip to content

Commit

Permalink
Fix outputs.tf output
Browse files Browse the repository at this point in the history
  • Loading branch information
carlssonk committed Sep 28, 2024
1 parent 478cc26 commit 7c00134
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions scripts/ci_set_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,16 @@ for module_dir in "$MODULES_DIR"/*; do
module_name=$(basename "$module_dir")
echo "Processing module: $module_name"

output_file="$module_dir/outputs.tf"

if [ "$STEP_NAME" = "iam" ]; then
echo " Removing everything except for iam.tf, variables.tf, outputs.tf"
for file in "$module_dir"/*; do
if [[ "$(basename "$file")" != "iam.tf" && "$(basename "$file")" != "variables.tf" && "$(basename "$file")" != "outputs.tf" ]]; then
rm -rf $file
fi
done

output_file="$module_dir/outputs.tf"

if [ -f "$output_file" ]; then
echo " Setting outputs.tf values to null to prevent 'Error: Unsupported attribute'"
modified_content=$(sed -E 's/value = .*/value = null/' "$output_file")
Expand All @@ -33,7 +34,7 @@ for module_dir in "$MODULES_DIR"/*; do
elif [ "$STEP_NAME" = "resources" ]; then
rm -rf "$module_dir/iam.tf"
echo " Removed iam.tf"
echo 'output "policy_document" { value = null }' >> outputs.tf
echo 'output "policy_document" { value = null }' >> "$output_file"
echo " Added null output policy_document to outputs.tf"
fi
fi
Expand Down

0 comments on commit 7c00134

Please sign in to comment.