Skip to content

Commit 15f4463

Browse files
author
Sean Sundberg
authored
Adds test for security groups to verify process (#34)
Signed-off-by: Sean Sundberg <[email protected]>
1 parent cc2eccb commit 15f4463

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.github/scripts/validate-deploy.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,14 @@ if ! ibmcloud is vpc "${VPC_ID}"; then
3333
exit 1
3434
fi
3535

36+
echo "Testing security group rules"
37+
ibmcloud is security-groups --output JSON | \
38+
jq --arg VPC_NAME "${VPC_NAME}" '.[] | select(.vpc.name == $VPC_NAME) | .rules[]'
39+
OPEN_RULES=$(ibmcloud is security-groups --output JSON | jq -c --arg VPC_NAME "${VPC_NAME}" '.[] | select(.vpc.name == $VPC_NAME) | .rules[] | select(.remote.cidr == "0.0.0.0/0")')
40+
if [[ -n "${OPEN_RULES}" ]]; then
41+
echo "Rules found with public internet address"
42+
echo "${OPEN_RULES}"
43+
exit 1
44+
fi
45+
3646
exit 0

0 commit comments

Comments
 (0)