From 7866fe31b9352370d439befd118a4549ab3faa86 Mon Sep 17 00:00:00 2001 From: joao-diasx Date: Wed, 27 Nov 2024 11:08:41 -0300 Subject: [PATCH] Adding rules for security group --- vpc.tf | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vpc.tf b/vpc.tf index 53f9112..84135bb 100644 --- a/vpc.tf +++ b/vpc.tf @@ -31,3 +31,21 @@ resource "ibm_is_security_group" "sg" { name = var.security_group_name vpc = var.create_vpc ? ibm_is_vpc.vpc[0].id : data.ibm_is_vpc.existing_vpc[0].id } + +resource "ibm_is_security_group_rule" "allow_vpn_ports" { + direction = "inbound" + group = ibm_is_security_group.sg.id + ip_version = "ipv4" + remote = "0.0.0.0/0" + + tcp { + port_min = 22 + port_max = 443 + } +} +resource "ibm_is_security_group_rule" "allow_all_outbound" { + direction = "outbound" + group = ibm_is_security_group.sg.id + remote = "0.0.0.0/0" + ip_version = "ipv4" +} \ No newline at end of file