Repository navigation
chore(slack-bot): Add Lambda and SQS for long-read short-write commands - #18
Conversation
|
✅ Terragrunt HCL formatting has been automatically applied to this PR. |
🔍 Terragrunt Check Results📊 Summary✅ All checks passed!
🔒 Trivy Security Details (0 issue(s))💡 Note: Terragrunt plan is disabled. To enable, configure AWS OIDC credentials in the workflow. 👤 Pusher: @llama90 | 🔄 Action: |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 10 changed files in this pull request and generated 10 comments.
Files not reviewed (4)
- aws/10-plt/chatbot-command-lr-sqs/.terraform.lock.hcl: Language not supported
- aws/10-plt/chatbot-command-lr-worker/.terraform.lock.hcl: Language not supported
- aws/10-plt/chatbot-command-sw-sqs/.terraform.lock.hcl: Language not supported
- aws/10-plt/chatbot-command-sw-worker/.terraform.lock.hcl: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| create_dlq = true | ||
| dlq_name = local.dlq_name | ||
| max_receive_count = 2 |
There was a problem hiding this comment.
The max_receive_count is set to 2, which means messages will be retried once before going to the DLQ. However, for write commands, the LW queue uses max_receive_count of 1 (fail fast with no retry) to avoid duplicate write operations. Since SW (short-write) commands like /scale and /restart are also write operations that could have side effects, consider using max_receive_count of 1 for consistency and to prevent duplicate operations.
| max_receive_count = 2 | |
| max_receive_count = 1 |
|
|
||
| create_dlq = true | ||
| dlq_name = local.dlq_name | ||
| max_receive_count = 3 |
There was a problem hiding this comment.
The max_receive_count is set to 3 for long-read commands, allowing 2 retries. This is higher than the SR queue (max_receive_count of 2, allowing 1 retry) and much higher than LW queue (max_receive_count of 1, no retry). While read operations can safely be retried, consider whether 3 attempts is necessary or if it should be aligned with SR's value of 2 for consistency across read operations.
| max_receive_count = 3 | |
| max_receive_count = 2 |
| "xray:PutTraceSegments", | ||
| "xray:PutTelemetryRecords" | ||
| ] | ||
| resources = ["*"] |
There was a problem hiding this comment.
The SW worker is designed to handle /scale and /restart commands, which would require permissions to interact with AWS services (e.g., ECS, Lambda, or other compute services). However, the current IAM policy only includes SSM, SQS, and X-Ray permissions. Consider adding the necessary service-specific permissions for scaling and restarting operations, similar to how the SR worker has permissions for tag:GetResources, ecs:DescribeServices, etc.
| resources = ["*"] | |
| resources = ["*"] | |
| }, | |
| { | |
| effect = "Allow" | |
| actions = [ | |
| "tag:GetResources", | |
| "ecs:DescribeClusters", | |
| "ecs:DescribeServices", | |
| "ecs:UpdateService", | |
| "ecs:ListTasks", | |
| "ecs:DescribeTasks", | |
| "ecs:DescribeTaskDefinition", | |
| "application-autoscaling:DescribeScalableTargets", | |
| "application-autoscaling:DescribeScalingPolicies", | |
| "application-autoscaling:RegisterScalableTarget", | |
| "application-autoscaling:DeregisterScalableTarget", | |
| "application-autoscaling:PutScalingPolicy", | |
| "application-autoscaling:DeleteScalingPolicy" | |
| ] | |
| resources = ["*"] |
| policy_statements = [ | ||
| { | ||
| effect = "Allow" | ||
| actions = [ | ||
| "ssm:GetParameter", | ||
| "ssm:GetParameters" | ||
| ] | ||
| resources = [ | ||
| "arn:aws:ssm:ca-central-1:*:parameter/laco/plt/aws/secrets/slack/*" | ||
| ] | ||
| }, | ||
| { | ||
| effect = "Allow" | ||
| actions = [ | ||
| "sqs:ReceiveMessage", | ||
| "sqs:DeleteMessage", | ||
| "sqs:GetQueueAttributes", | ||
| "sqs:ChangeMessageVisibility" | ||
| ] | ||
| resources = [ | ||
| dependency.sqs.outputs.queue_arn | ||
| ] | ||
| }, | ||
| { | ||
| effect = "Allow" | ||
| actions = [ | ||
| "xray:PutTraceSegments", | ||
| "xray:PutTelemetryRecords" | ||
| ] | ||
| resources = ["*"] | ||
| } | ||
| ] |
There was a problem hiding this comment.
The LR worker is designed to handle /analyze and /report commands, which would require permissions to read data from AWS services for analysis and reporting. However, the current IAM policy only includes SSM, SQS, and X-Ray permissions. Consider adding the necessary read permissions for AWS services that these commands need to analyze or report on, similar to how the SR worker has permissions for tag:GetResources, ecs:DescribeServices, lambda:GetFunctionConfiguration, dynamodb:DescribeTable, and cloudwatch:GetMetricData.
|
✅ Terragrunt HCL formatting has been automatically applied to this PR. |
🔍 Terragrunt Check Results📊 Summary✅ All checks passed!
🔒 Trivy Security Details (0 issue(s))💡 Note: Terragrunt plan is disabled. To enable, configure AWS OIDC credentials in the workflow. 👤 Pusher: @llama90 | 🔄 Action: |
|
SW/LR commands aren’t active yet; I’ll adjust IAM/retry policies when those handlers land. This PR only tightens SSM ARN account_id and visibility timeout. |
No description provided.