Skip to content

Commit

Permalink
feat: Add create_before_destroy lifecycle hook to security groups c…
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored and spr-mweber3 committed Apr 26, 2022
1 parent abdee24 commit 94c2617
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ resource "aws_security_group" "cluster" {
{ "Name" = local.cluster_sg_name },
var.cluster_security_group_tags
)

lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group_rule" "cluster" {
Expand Down
6 changes: 6 additions & 0 deletions modules/eks-managed-node-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ resource "aws_security_group" "this" {
{ "Name" = local.security_group_name },
var.security_group_tags
)

# https://github.com/hashicorp/terraform-provider-aws/issues/2445
# https://github.com/hashicorp/terraform-provider-aws/issues/9692
lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group_rule" "this" {
Expand Down
6 changes: 6 additions & 0 deletions modules/self-managed-node-group/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ resource "aws_security_group" "this" {
},
var.security_group_tags
)

# https://github.com/hashicorp/terraform-provider-aws/issues/2445
# https://github.com/hashicorp/terraform-provider-aws/issues/9692
lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group_rule" "this" {
Expand Down
4 changes: 4 additions & 0 deletions node_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ resource "aws_security_group" "node" {
},
var.node_security_group_tags
)

lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group_rule" "node" {
Expand Down

0 comments on commit 94c2617

Please sign in to comment.