Skip to content

Commit

Permalink
fix(eks): missing permissions to add and remove tags when creating EK…
Browse files Browse the repository at this point in the history
…S cluster resource

Added missing permissions for `eks:TagResource` and `eks:UntagResource`.
Updated unit and integ test expectations to include the added permissions.

Closes #7163
  • Loading branch information
shivlaks committed Apr 10, 2020
1 parent ed851d8 commit d150826
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
11 changes: 10 additions & 1 deletion packages/@aws-cdk/aws-eks/lib/cluster-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,16 @@ export class ClusterResource extends Construct {
}));

this.creationRole.addToPolicy(new iam.PolicyStatement({
actions: [ 'eks:CreateCluster', 'eks:DescribeCluster', 'eks:DeleteCluster', 'eks:UpdateClusterVersion', 'eks:UpdateClusterConfig', 'eks:CreateFargateProfile' ],
actions: [
'eks:CreateCluster',
'eks:DescribeCluster',
'eks:DeleteCluster',
'eks:UpdateClusterVersion',
'eks:UpdateClusterConfig',
'eks:CreateFargateProfile',
'eks:TagResource',
'eks:UntagResource'
],
resources: resourceArns
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,9 @@
"eks:DeleteCluster",
"eks:UpdateClusterVersion",
"eks:UpdateClusterConfig",
"eks:CreateFargateProfile"
"eks:CreateFargateProfile",
"eks:TagResource",
"eks:UntagResource"
],
"Effect": "Allow",
"Resource": [
Expand Down
8 changes: 6 additions & 2 deletions packages/@aws-cdk/aws-eks/test/test.cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -718,7 +718,9 @@ export = {
'eks:DeleteCluster',
'eks:UpdateClusterVersion',
'eks:UpdateClusterConfig',
'eks:CreateFargateProfile'
'eks:CreateFargateProfile',
'eks:TagResource',
'eks:UntagResource'
],
Effect: 'Allow',
Resource: [ {
Expand Down Expand Up @@ -826,7 +828,9 @@ export = {
'eks:DeleteCluster',
'eks:UpdateClusterVersion',
'eks:UpdateClusterConfig',
'eks:CreateFargateProfile'
'eks:CreateFargateProfile',
'eks:TagResource',
'eks:UntagResource'
],
Effect: 'Allow',
Resource: [ '*' ]
Expand Down

0 comments on commit d150826

Please sign in to comment.