Skip to content

Commit

Permalink
fix: Make service, task, and task sets wait for their respective poli…
Browse files Browse the repository at this point in the history
…cy attachment to ensure permissions are available (#201)
  • Loading branch information
bryantbiggs authored May 31, 2024
1 parent 84cf54a commit 2033858
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.4
rev: v1.90.0
hooks:
- id: terraform_fmt
- id: terraform_wrapper_module_for_each
Expand Down
14 changes: 12 additions & 2 deletions modules/service/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ resource "aws_ecs_service" "this" {
delete = try(var.timeouts.delete, null)
}

depends_on = [aws_iam_role_policy_attachment.service]
depends_on = [
aws_iam_role_policy_attachment.service
]

lifecycle {
ignore_changes = [
Expand Down Expand Up @@ -387,7 +389,9 @@ resource "aws_ecs_service" "ignore_task_definition" {
delete = try(var.timeouts.delete, null)
}

depends_on = [aws_iam_role_policy_attachment.service]
depends_on = [
aws_iam_role_policy_attachment.service
]

lifecycle {
ignore_changes = [
Expand Down Expand Up @@ -736,6 +740,12 @@ resource "aws_ecs_task_definition" "this" {

tags = merge(var.tags, var.task_tags)

depends_on = [
aws_iam_role_policy_attachment.tasks,
aws_iam_role_policy_attachment.task_exec,
aws_iam_role_policy_attachment.task_exec_additional,
]

lifecycle {
create_before_destroy = true
}
Expand Down
9 changes: 8 additions & 1 deletion wrappers/cluster/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
}
}
}
9 changes: 8 additions & 1 deletion wrappers/container-definition/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
}
}
}
9 changes: 8 additions & 1 deletion wrappers/service/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
}
}
}
9 changes: 8 additions & 1 deletion wrappers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
terraform {
required_version = ">= 0.13.1"
required_version = ">= 1.0"

required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 4.66.1"
}
}
}

0 comments on commit 2033858

Please sign in to comment.