Skip to content

Commit

Permalink
fix: Add lifecycle rules to SG definitions to allow SG deletion (#94)
Browse files Browse the repository at this point in the history
* added lifecycle parameters to security group rules

* fix: Add lifecycle rules to SGs
  • Loading branch information
George Scott authored Jun 22, 2023
1 parent 3c1b61f commit 3000b24
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions modules/app_lb/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ locals {
// -> george.scott@wandb.com :: 2023-06-20
////////////////////////////////////////////////////////////////////////////////////////////
resource "aws_security_group" "inbound_http" {
name = "${var.namespace}-alb-inbound_http"
description = "Allow http traffic to wandb"
vpc_id = var.network_id
name = "${var.namespace}-alb-inbound_http"
description = "Allow http traffic to wandb"
revoke_rules_on_delete = true
vpc_id = var.network_id

ingress {
from_port = local.http_port
Expand All @@ -22,12 +23,21 @@ resource "aws_security_group" "inbound_http" {
cidr_blocks = var.allowed_inbound_cidr
ipv6_cidr_blocks = var.allowed_inbound_ipv6_cidr
}

lifecycle {
create_before_destroy = true
}

timeouts {
delete = "3m"
}
}

resource "aws_security_group" "inbound_https" {
name = "${var.namespace}-alb-inbound_https"
description = "Allow https traffic to wandb"
vpc_id = var.network_id
name = "${var.namespace}-alb-inbound_https"
description = "Allow https traffic to wandb"
revoke_rules_on_delete = true
vpc_id = var.network_id

ingress {
from_port = local.https_port
Expand All @@ -37,6 +47,14 @@ resource "aws_security_group" "inbound_https" {
cidr_blocks = var.allowed_inbound_cidr
ipv6_cidr_blocks = var.allowed_inbound_ipv6_cidr
}

lifecycle {
create_before_destroy = true
}

timeouts {
delete = "3m"
}
}


Expand Down

0 comments on commit 3000b24

Please sign in to comment.