Skip to content

Commit 4bb6276

Browse files
authored
Update to version v1.2.3
Fix issue #45 , updating IAM policy to fix deployment of use cases from deployment dashboard
2 parents b2dac0f + b1e225c commit 4bb6276

File tree

3 files changed

+58
-40
lines changed

3 files changed

+58
-40
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.2.3] - 2024-02-06
9+
10+
### Fixed
11+
12+
- Fix AWS IAM policy that causes use case deployments to fail when creating, updating or deleting from the deployment dashboard.
13+
814
## [1.2.2] - 2024-01-11
915

1016
### Fixed

source/infrastructure/lib/use-case-management/management-stack.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,8 @@ const buildCfnDeployRole = (scope: Construct): iam.Role => {
441441
'iam:GetRolePolicy',
442442
'iam:PutRolePolicy',
443443
'iam:TagRole',
444-
'iam:UpdateAssumeRolePolicy'
444+
'iam:UpdateAssumeRolePolicy',
445+
'iam:PassRole'
445446
],
446447
resources: [
447448
`arn:${cdk.Aws.PARTITION}:iam::${cdk.Aws.ACCOUNT_ID}:role/*`,
@@ -451,15 +452,6 @@ const buildCfnDeployRole = (scope: Construct): iam.Role => {
451452
...awsTagKeysCondition
452453
}
453454
}),
454-
new iam.PolicyStatement({
455-
effect: iam.Effect.ALLOW,
456-
actions: ['iam:PassRole'],
457-
resources: [`arn:${cdk.Aws.PARTITION}:iam::${cdk.Aws.ACCOUNT_ID}:role/*`],
458-
conditions: {
459-
...awsCalledViaCondition,
460-
...awsTagKeysCondition
461-
}
462-
}),
463455
new iam.PolicyStatement({
464456
effect: iam.Effect.ALLOW,
465457
actions: ['lambda:AddPermission', 'lambda:RemovePermission', 'lambda:InvokeFunction'],
@@ -811,7 +803,21 @@ const buildCfnDeployRole = (scope: Construct): iam.Role => {
811803
...awsCalledViaCondition,
812804
...awsTagKeysCondition
813805
}
814-
})
806+
}),
807+
new iam.PolicyStatement({
808+
effect: iam.Effect.ALLOW,
809+
actions: [
810+
'cloudformation:CreateStack',
811+
'cloudformation:UpdateStack',
812+
'cloudformation:DeleteStack'
813+
],
814+
resources: [
815+
`arn:${cdk.Aws.PARTITION}:cloudformation:${cdk.Aws.REGION}:${cdk.Aws.ACCOUNT_ID}:stack/*`
816+
],
817+
conditions: {
818+
...awsTagKeysCondition
819+
}
820+
})
815821
]
816822
})
817823
}

source/infrastructure/test/use-case-management/management-stack.test.ts

Lines changed: 35 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,8 @@ describe('When creating a use case management Stack', () => {
447447
'iam:GetRolePolicy',
448448
'iam:PutRolePolicy',
449449
'iam:TagRole',
450-
'iam:UpdateAssumeRolePolicy'
450+
'iam:UpdateAssumeRolePolicy',
451+
'iam:PassRole'
451452
],
452453
Condition: {
453454
'ForAllValues:StringEquals': {
@@ -490,34 +491,6 @@ describe('When creating a use case management Stack', () => {
490491
}
491492
]
492493
},
493-
{
494-
Action: 'iam:PassRole',
495-
Condition: {
496-
'ForAnyValue:StringEquals': {
497-
'aws:CalledVia': ['cloudformation.amazonaws.com']
498-
},
499-
'ForAllValues:StringEquals': {
500-
'aws:TagKeys': ['createdVia', 'userId']
501-
}
502-
},
503-
Effect: 'Allow',
504-
Resource: {
505-
'Fn::Join': [
506-
'',
507-
[
508-
'arn:',
509-
{
510-
Ref: 'AWS::Partition'
511-
},
512-
':iam::',
513-
{
514-
Ref: 'AWS::AccountId'
515-
},
516-
':role/*'
517-
]
518-
]
519-
}
520-
},
521494
{
522495
Action: ['lambda:AddPermission', 'lambda:RemovePermission', 'lambda:InvokeFunction'],
523496
Condition: {
@@ -1307,6 +1280,39 @@ describe('When creating a use case management Stack', () => {
13071280
]
13081281
]
13091282
}
1283+
},
1284+
{
1285+
Action: [
1286+
'cloudformation:CreateStack',
1287+
'cloudformation:UpdateStack',
1288+
'cloudformation:DeleteStack'
1289+
],
1290+
Condition: {
1291+
'ForAllValues:StringEquals': {
1292+
'aws:TagKeys': ['createdVia', 'userId']
1293+
}
1294+
},
1295+
Effect: 'Allow',
1296+
Resource: {
1297+
'Fn::Join': [
1298+
'',
1299+
[
1300+
'arn:',
1301+
{
1302+
Ref: 'AWS::Partition'
1303+
},
1304+
':cloudformation:',
1305+
{
1306+
Ref: 'AWS::Region'
1307+
},
1308+
':',
1309+
{
1310+
Ref: 'AWS::AccountId'
1311+
},
1312+
':stack/*'
1313+
]
1314+
]
1315+
}
13101316
}
13111317
]
13121318
}

0 commit comments

Comments
 (0)