Skip to content

Commit

Permalink
file type for alert policies (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
bolyachevets authored Nov 14, 2024
1 parent 24ec1f0 commit 58b3b2c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gcp/project_setup/gcp_infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,20 @@ bigquery.googleapis.com/projects/${HOST_PROJECT_ID}/datasets/cloud_run_logs_${TA
# create alerts
ALERT_POLICIES_DIR="alert_policies"

for policy_file in "$ALERT_POLICIES_DIR"/*.yml; do
for policy_file in "$ALERT_POLICIES_DIR"/*.json; do
policy_name=$(basename "$policy_file")

echo "Processing $policy_name..."

envsubst < "$policy_file" > alert_policy.yml
gcloud alpha monitoring policies create --policy-from-file=alert_policy.yml
envsubst < "$policy_file" > alert_policy.json
gcloud alpha monitoring policies create --policy-from-file=alert_policy.json

if [ $? -eq 0 ]; then
echo "Successfully created alert policy from $policy_name."
else
echo "Failed to create alert policy from $policy_name."
fi

rm -f alert_policy.yml
rm -f alert_policy.json

done

0 comments on commit 58b3b2c

Please sign in to comment.