Skip to content
This repository was archived by the owner on Aug 12, 2024. It is now read-only.

Commit 5b226d0

Browse files
author
Sean Sundberg
authored
Replaces ibmcloud cli with ibm_is_network_acl_rule resource (#58)
Signed-off-by: Sean Sundberg <[email protected]>
1 parent 6d9a476 commit 5b226d0

File tree

2 files changed

+10
-199
lines changed

2 files changed

+10
-199
lines changed

main.tf

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,15 @@ data ibm_is_subnet vpc_subnet {
144144
identifier = lookup(local.vpc_subnets[count.index], "id", "")
145145
}
146146

147-
resource null_resource setup_acl_rules {
148-
count = !var.exists && var.vpc_subnet_count > 0 ? 1 : 0
149-
150-
provisioner "local-exec" {
151-
command = "${path.module}/scripts/setup-acl-rules.sh '${lookup(data.ibm_is_subnet.vpc_subnet[0], "network_acl", "")}' '${var.region}' '${var.resource_group_name}'"
152-
153-
environment = {
154-
IBMCLOUD_API_KEY = var.ibmcloud_api_key
155-
ACL_RULES = jsonencode(local.acl_rules)
156-
BIN_DIR = module.setup_clis.bin_dir
157-
}
158-
}
147+
resource ibm_is_network_acl_rule rules {
148+
count = !var.exists && var.vpc_subnet_count > 0 ? length(local.acl_rules) : 0
149+
150+
network_acl = data.ibm_is_subnet.vpc_subnet[0].network_acl
151+
name = local.acl_rules[count.index].name
152+
action = local.acl_rules[count.index].action
153+
source = local.acl_rules[count.index].source
154+
destination = local.acl_rules[count.index].destination
155+
direction = local.acl_rules[count.index].direction
159156
}
160157

161158
# from https://cloud.ibm.com/docs/vpc?topic=vpc-service-endpoints-for-vpc
@@ -199,7 +196,7 @@ resource ibm_is_security_group_rule default_inbound_https {
199196

200197
resource ibm_container_vpc_cluster cluster {
201198
count = !var.exists ? 1 : 0
202-
depends_on = [null_resource.print_resources, null_resource.setup_acl_rules]
199+
depends_on = [null_resource.print_resources, ibm_is_network_acl_rule.rules]
203200

204201
name = local.cluster_name
205202
vpc_id = local.vpc_id

scripts/setup-acl-rules.sh

Lines changed: 0 additions & 186 deletions
This file was deleted.

0 commit comments

Comments
 (0)