Skip to content

chore(slack-bot): Add Lambda and SQS for long-read short-write commands - #18

Merged
llama90 merged 6 commits into
mainfrom
feature/quadrant-lr-sw
Jan 22, 2026
Merged

llama90 merged 6 commits into
mainfrom
feature/quadrant-lr-sw

Conversation

@llama90

@llama90 llama90 commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Terragrunt HCL formatting has been automatically applied to this PR.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Terragrunt Check Results

📊 Summary

✅ All checks passed!

Check Status Issues Scope
🖌 HCL Format ✅ success - All HCL files
🤖 HCL Validate ✅ success - All HCL files
🔒 Trivy ✅ success 0 critical, 0 high, 0 medium aws/10-plt/chatbot-command-lr-sqs, aws/10-plt/chatbot-command-lr-worker, aws/10-plt/chatbot-command-sr-worker, aws/10-plt/chatbot-command-sw-sqs, aws/10-plt/chatbot-command-sw-worker, aws/10-plt/chatbot-eventbridge

🔒 Trivy Security Details (0 issue(s))
Trivy scanning is disabled for Terragrunt HCL files
To enable security scanning, configure Terragrunt to generate .tf files first

💡 Note: Terragrunt plan is disabled. To enable, configure AWS OIDC credentials in the workflow.


👤 Pusher: @llama90 | 🔄 Action: pull_request | ⚙️ Workflow: Terragrunt Check

@llama90
llama90 requested a review from Copilot January 13, 2026 02:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
max_receive_count = 2
max_receive_count = 1

Copilot uses AI. Check for mistakes.

create_dlq = true
dlq_name = local.dlq_name
max_receive_count = 3

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
max_receive_count = 3
max_receive_count = 2

Copilot uses AI. Check for mistakes.
"xray:PutTraceSegments",
"xray:PutTelemetryRecords"
]
resources = ["*"]

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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 = ["*"]

Copilot uses AI. Check for mistakes.
Comment on lines +88 to +119
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 = ["*"]
}
]

Copilot AI Jan 13, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@github-actions

Copy link
Copy Markdown
Contributor

✅ Terragrunt HCL formatting has been automatically applied to this PR.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 Terragrunt Check Results

📊 Summary

✅ All checks passed!

Check Status Issues Scope
🖌 HCL Format ✅ success - All HCL files
🤖 HCL Validate ✅ success - All HCL files
🔒 Trivy ✅ success 0 critical, 0 high, 0 medium aws/10-plt/chatbot-command-lr-sqs, aws/10-plt/chatbot-command-lr-worker, aws/10-plt/chatbot-command-sr-worker, aws/10-plt/chatbot-command-sw-sqs, aws/10-plt/chatbot-command-sw-worker, aws/10-plt/chatbot-eventbridge, aws/10-plt/slack-router-lambda

🔒 Trivy Security Details (0 issue(s))
Trivy scanning is disabled for Terragrunt HCL files
To enable security scanning, configure Terragrunt to generate .tf files first

💡 Note: Terragrunt plan is disabled. To enable, configure AWS OIDC credentials in the workflow.


👤 Pusher: @llama90 | 🔄 Action: pull_request | ⚙️ Workflow: Terragrunt Check

@llama90

llama90 commented Jan 22, 2026

Copy link
Copy Markdown
Contributor Author

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.

@llama90
llama90 merged commit 9460e00 into main Jan 22, 2026
@llama90
llama90 deleted the feature/quadrant-lr-sw branch January 22, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants