feat(cloudformation): add AWS CloudFormation integration with 7 operations#3964
feat(cloudformation): add AWS CloudFormation integration with 7 operations#3964waleedlatif1 merged 2 commits intostagingfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryMedium Risk Overview Updates docs and icon mappings to expose Reviewed by Cursor Bugbot for commit ccf0e79. Configure here. |
Greptile SummaryThis PR adds a complete AWS CloudFormation integration to Sim with 7 operations: Describe Stacks, List Stack Resources, Describe Stack Events, Detect Stack Drift, Describe Stack Drift Detection Status, Get Template, and Validate Template. The integration follows the established Sim tool → API route → AWS SDK pattern used by the existing CloudWatch block, and all previously flagged pagination gaps have been resolved.
Confidence Score: 5/5Safe to merge — all pagination issues from the prior review are resolved; only a minor NaN edge case on invalid limit input remains All P1 findings from previous review iterations (missing pagination for list-stack-resources, describe-stacks, describe-stack-events) are confirmed fixed. The only remaining finding is a P2 edge case where a non-numeric limit value produces NaN, which the server-side Zod schema would reject with a 500 error. This does not affect the primary happy path and is not a blocker. apps/sim/blocks/blocks/cloudformation.ts — minor parsedLimit NaN guard improvement Important Files Changed
Sequence DiagramsequenceDiagram
actor User
participant UI as CloudFormation Block
participant Executor as Sim Executor
participant BlockCfg as tools.config (cloudformation.ts)
participant ToolDef as ToolConfig (tools/cloudformation/)
participant Route as /api/tools/cloudformation/{op}
participant AWS as AWS CloudFormation SDK
User->>UI: Configure operation, credentials, region, stack params
User->>Executor: Run workflow
Executor->>BlockCfg: tools.config.tool(params)
BlockCfg-->>Executor: cloudformation_{operation}
Executor->>BlockCfg: tools.config.params(params)
Note over BlockCfg: Extract credentials, parseInt(limit)
BlockCfg-->>Executor: Typed param object
Executor->>ToolDef: Execute ToolConfig (remap awsRegion to region)
ToolDef->>Route: POST { region, accessKeyId, secretAccessKey, ... }
Route->>Route: checkInternalAuth then Zod parse
Route->>Route: new CloudFormationClient({ region, credentials })
alt Paginated ops (describe-stacks, list-resources, describe-events)
loop NextToken pages
Route->>AWS: client.send(Command + NextToken?)
AWS-->>Route: { items[], NextToken? }
Note over Route: describe-events stops when count >= limit
end
else Single-call ops (detect-drift, drift-status, get-template, validate-template)
Route->>AWS: client.send(Command)
AWS-->>Route: Single response
end
Route-->>ToolDef: NextResponse.json({ success: true, output })
ToolDef-->>Executor: transformResponse returns typed output
Executor-->>UI: Outputs available to downstream blocks
Reviews (2): Last reviewed commit: "fix(cloudformation): add pagination to l..." | Re-trigger Greptile |
apps/sim/app/api/tools/cloudformation/list-stack-resources/route.ts
Outdated
Show resolved
Hide resolved
apps/sim/app/api/tools/cloudformation/describe-stack-events/route.ts
Outdated
Show resolved
Hide resolved
…-stacks, and describe-stack-events routes
|
@greptile |
|
@cursor review |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Metric statistics output timestamps changed from seconds to milliseconds
- Restored timestamp output to seconds by converting milliseconds back using Math.floor(getTime() / 1000) to maintain consistency with the seconds-based input parameters.
Preview
diff --git a/apps/sim/app/api/tools/cloudwatch/get-metric-statistics/route.ts b/apps/sim/app/api/tools/cloudwatch/get-metric-statistics/route.ts
--- a/apps/sim/app/api/tools/cloudwatch/get-metric-statistics/route.ts
+++ b/apps/sim/app/api/tools/cloudwatch/get-metric-statistics/route.ts
@@ -72,7 +72,7 @@
const datapoints = (response.Datapoints ?? [])
.sort((a, b) => (a.Timestamp?.getTime() ?? 0) - (b.Timestamp?.getTime() ?? 0))
.map((dp) => ({
- timestamp: dp.Timestamp ? dp.Timestamp.getTime() : 0,
+ timestamp: dp.Timestamp ? Math.floor(dp.Timestamp.getTime() / 1000) : 0,
average: dp.Average,
sum: dp.Sum,
minimum: dp.Minimum,This Bugbot Autofix run was free. To enable autofix for future PRs, go to the Cursor dashboard.
Reviewed by Cursor Bugbot for commit ccf0e79. Configure here.


Summary
Type of Change
Testing
Tested manually
Checklist