feat: migrate from aws-sdk-go v1 to v2#50
Conversation
Migrate AWS SDK usage from the deprecated aws-sdk-go (v1) to aws-sdk-go-v2. This addresses issue #12. Changes: - Replace session-based auth with config-based auth pattern - Update Secrets Manager client to v2 API - Replace endpoints.UsEast2RegionID with local constant - Remove v1 dependency entirely Closes #12
|
Claude finished @ian-flores's task —— View job Reviewing PR #50
Review submitted with feedback on security, code quality, and one suggestion for improved nil handling. |
There was a problem hiding this comment.
AWS SDK v2 Migration Review
Overall this is a clean migration from AWS SDK v1 to v2. The changes follow the correct v2 patterns and improve code readability.
Security (Credential Handling)
- ✅
config.LoadDefaultConfig(ctx, ...)correctly passes context and uses the standard credential chain - ✅ Region configuration properly flows through
GetAWSRegion()
Code Quality
api/product/secret.go
- The flattened control flow (early returns instead of nested if-else) is easier to follow
- Suggestion: Consider adding a nil check for
valueOutput.SecretStringat line 156. The v2 API can returnSecretBinaryinstead ofSecretStringfor binary secrets:if valueOutput.SecretString == nil { return "", errors.New("secret returned as binary, expected string") }
api/product/util.go
- Using
const defaultAWSRegion = "us-east-2"instead ofendpoints.UsEast2RegionIDis a reasonable tradeoff - removes SDK dependency while maintaining backwards compatibility
Dependencies
- ✅ v1 SDK (
github.com/aws/aws-sdk-go) and its transitive dependency (go-jmespath) properly removed - ✅ v2 modules appropriately scoped (only importing what's needed)
Testing
- Test updated to use hardcoded region string instead of SDK constant - maintains test coverage
Staging Verification (ganso01-staging)Deployed adhoc image Operator rolled out cleanly: Secrets Manager calls succeeding: Logs confirm the operator is fetching credentials from AWS Secrets Manager using the v2 SDK without errors: Multiple controllers (site, postgresdatabase, workbench, connect) all reconciled successfully with secrets sourced from Secrets Manager. No AWS-related errors in logs. The only errors present ( |
# [1.12.0](v1.11.2...v1.12.0) (2026-02-19) ### Features * migrate from aws-sdk-go v1 to v2 ([#50](#50)) ([55708e7](55708e7))
Summary
Test plan
api/producttests passCloses #12