Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Commit

Permalink
fix: Fix cycle error during the destroy phase when we change workers …
Browse files Browse the repository at this point in the history
…order (terraform-aws-modules#1043)

NOTES: Keep in mind that changing the order of workers group is a destructive operation. All workers group are destroyed and recreated. If you want to do this safely, you should move then in state with `terraform state mv` until we manage workers groups as maps.
  • Loading branch information
barryib authored and BARRY Thierno Ibrahima (Canal Plus Prestataire) committed Oct 25, 2020
1 parent f820fac commit ff5f0f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions workers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ resource "random_pet" "workers" {
keepers = {
lc_name = aws_launch_configuration.workers[count.index].name
}

lifecycle {
create_before_destroy = true
}
}

resource "aws_security_group" "workers" {
Expand Down Expand Up @@ -409,6 +413,10 @@ resource "aws_iam_instance_profile" "workers" {
)

path = var.iam_path

lifecycle {
create_before_destroy = true
}
}

resource "aws_iam_role_policy_attachment" "workers_AmazonEKSWorkerNodePolicy" {
Expand Down
5 changes: 5 additions & 0 deletions workers_launch_template.tf
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@ resource "random_pet" "workers_launch_template" {
)
)
}

lifecycle {
create_before_destroy = true
}
Expand All @@ -506,4 +507,8 @@ resource "aws_iam_instance_profile" "workers_launch_template" {
local.default_iam_role_id,
)
path = var.iam_path

lifecycle {
create_before_destroy = true
}
}

0 comments on commit ff5f0f7

Please sign in to comment.