This repository was archived by the owner on Aug 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -128,7 +128,11 @@ resource null_resource open_acl_rules {
128128 count = ! var. exists && var. vpc_subnet_count > 0 ? 1 : 0
129129
130130 provisioner "local-exec" {
131- command = " ${ path . module } /scripts/open-acl-rules.sh ${ data . ibm_is_subnet . vpc_subnet [0 ]. network_acl } "
131+ command = " ${ path . module } /scripts/open-acl-rules.sh '${ data . ibm_is_subnet . vpc_subnet [0 ]. network_acl } ' '${ var . region } ' '${ var . resource_group_name } '"
132+
133+ environment = {
134+ IBMCLOUD_API_KEY = var.ibmcloud_api_key
135+ }
132136 }
133137}
134138
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33NETWORK_ACL=" $1 "
4+ REGION=" $2 "
5+ RESOURCE_GROUP=" $3 "
46
5- # # TODO more sophisiticated logic needed to 1) test for existing rules and 2) place this rule in the right order
7+ if [[ -z " ${NETWORK_ACL} " ]] || [[ -z " ${REGION} " ]] || [[ -z " ${RESOURCE_GROUP} " ]]; then
8+ echo " Usage: open-acl-rules.sh NETWORK_ACL REGION RESOURCE_GROUP"
9+ exit 1
10+ fi
11+
12+ if [[ -z " ${IBMCLOUD_API_KEY} " ]]; then
13+ echo " IBMCLOUD_API_KEY environment variable must be set"
14+ exit 1
15+ fi
16+
17+ ibmcloud login --apikey " ${IBMCLOUD_API_KEY} " -g " ${RESOURCE_GROUP} " -r " ${REGION} "
618
719ibmcloud is network-acl-rule-add " ${NETWORK_ACL} " allow inbound all " 0.0.0.0/0" " 0.0.0.0/0" --name allow-all-ingress
820ibmcloud is network-acl-rule-add " ${NETWORK_ACL} " allow outbound all " 0.0.0.0/0" " 0.0.0.0/0" --name allow-all-egress
You can’t perform that action at this time.
0 commit comments