Skip to content

Commit dae79e8

Browse files
authored
Merge pull request #393 from architect/param-creds
fix: Creds flattened for aws-lite
2 parents 90eab42 + e008282 commit dae79e8

File tree

5 files changed

+72
-7
lines changed

5 files changed

+72
-7
lines changed

changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
---
44

5+
## [5.0.9] 2025-08-29
6+
7+
## Fixed
8+
9+
- When Credentials are passed as an argument `credentials` they need to be flattened when passed to AWS-lite.
10+
- Some test mocks were updated because a patch version of @architect/inventory broke the tests.
11+
12+
---
13+
514
## [5.0.8] 2025-01-23
615

716
### Changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function run (mod) {
5252
import('@aws-lite/ssm'),
5353
]
5454
let params = { region, plugins }
55-
if (options.credentials) params.credentials = options.credentials
55+
if (options.credentials) params = { ...options.credentials, ...params }
5656
if (options.inventory.inv?.aws?.profile) params.profile = options.inventory.inv.aws.profile
5757
awsLite(params)
5858
.then(aws => {
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = {
2-
package: function ({ cloudformation }) {
3-
cloudformation.pluginOne = true
4-
return cloudformation
2+
deploy: {
3+
start: function ({ cloudformation }) {
4+
cloudformation.pluginOne = true
5+
return cloudformation
6+
}
57
}
68
}
Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module.exports = {
2-
package: function ({ cloudformation }) {
3-
cloudformation.pluginTwo = true
4-
return cloudformation
2+
deploy: {
3+
start: function ({ cloudformation }) {
4+
cloudformation.pluginTwo = true
5+
return cloudformation
6+
}
57
}
68
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
let test = require('tape')
2+
let proxyquire = require('proxyquire')
3+
let inventory = require('@architect/inventory')
4+
5+
let awsLiteArgs = []
6+
let mockAwsLite = (args) => {
7+
awsLiteArgs.push(args)
8+
return Promise.resolve({
9+
cloudformation: {
10+
DescribeStacks: () => Promise.reject({ message: 'Stack does not exist', statusCode: 400 }),
11+
DescribeStackResources: () => Promise.resolve({ StackResources: [] }),
12+
},
13+
})
14+
}
15+
16+
// Mock the SAM module directly to prevent sam.json file creation
17+
let mockSam = proxyquire('../../src/sam', {
18+
'./00-before': (params, callback) => {
19+
// Skip file writing, just call callback with dry-run result
20+
callback(null, 'dry-run')
21+
},
22+
})
23+
24+
let deploy = proxyquire('../../', {
25+
'@aws-lite/client': mockAwsLite,
26+
'./src/sam': mockSam,
27+
})
28+
29+
test('deploy.sam credentials accepted', async t => {
30+
t.plan(3)
31+
let inv = await inventory({
32+
rawArc: '@app\ntest-app\n@static',
33+
deployStage: 'staging',
34+
shouldHydrate: false,
35+
})
36+
await deploy.sam({
37+
credentials: {
38+
accessKeyId: 'ASIATEST123456789',
39+
secretAccessKey: 'testSecretKey123456789',
40+
sessionToken: 'testSessionToken123456789',
41+
},
42+
inventory: inv,
43+
isDryRun: true,
44+
region: 'us-west-2',
45+
shouldHydrate: false, // Skip hydration to avoid inventory structure issues
46+
})
47+
t.ok(awsLiteArgs[0].accessKeyId, 'accessKeyId is present')
48+
t.ok(awsLiteArgs[0].secretAccessKey, 'secretAccessKey is present')
49+
t.ok(awsLiteArgs[0].sessionToken, 'sessionToken is present')
50+
51+
})
52+

0 commit comments

Comments
 (0)