fix(iam): omit checkcomponents from the ECS boundary in non-prod

This commit is contained in:
Adam Moussa 2026-09-21 16:20:40 -04:00
parent 30f88729a6
commit 8a45903271
No known key found for this signature in database
2 changed files with 20 additions and 5 deletions

View file

@ -45,11 +45,14 @@ data "aws_iam_policy_document" "ecs_task_boundary" {
resources = [aws_sqs_queue.jobs.arn]
}
statement {
sid = "CheckcomponentsSend"
effect = "Allow"
actions = ["sqs:SendMessage"]
resources = compact([var.checkcomponents_queue_arn])
dynamic "statement" {
for_each = var.checkcomponents_queue_arn == "" ? [] : [1]
content {
sid = "CheckcomponentsSend"
effect = "Allow"
actions = ["sqs:SendMessage"]
resources = [var.checkcomponents_queue_arn]
}
}
statement {

View file

@ -0,0 +1,12 @@
"""ECS task boundary stays a valid IAM document when Paychex is unset."""
from pathlib import Path
IAM = Path(__file__).resolve().parents[1] / "terraform" / "iam.tf"
def test_checkcomponents_send_omitted_when_queue_arn_empty():
text = IAM.read_text()
assert "compact([var.checkcomponents_queue_arn])" not in text
assert 'for_each = var.checkcomponents_queue_arn == "" ? [] : [1]' in text
assert 'sid = "CheckcomponentsSend"' in text