mirror of
https://github.com/Sea-Haven-Industries/meal-order-manager.git
synced 2026-09-30 04:13:12 +00:00
fix(iam): omit checkcomponents from the ECS boundary in non-prod (#202)
This commit is contained in:
parent
30f88729a6
commit
697deb94fd
2 changed files with 20 additions and 5 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
12
tests/test_terraform_iam.py
Normal file
12
tests/test_terraform_iam.py
Normal 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
|
||||
Loading…
Add table
Reference in a new issue