Skip to content

Commit

Permalink
feat: configure managerRole
Browse files Browse the repository at this point in the history
  • Loading branch information
Unerty committed Nov 2, 2021
1 parent 5014b88 commit 9fc97cf
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/cdk-gitlab-runner-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,18 +131,6 @@ export class GitlabRunnerStack extends Stack {
*/
const ec2ServicePrincipal = new ServicePrincipal("ec2.amazonaws.com", {});

/*
* ManagerInstanceProfile:
* Type: 'AWS::IAM::InstanceProfile'
*/
const managerInstanceProfile = new CfnInstanceProfile( // TODO: refactor this low level code
this,
"ManagerInstanceProfile",
{
roles: [managerRole.roleName], // TODO: Fix cyclical dependency! https://stackoverflow.com/questions/60307531/resolving-cyclical-dependencies-between-aws-cdk-cloudformation-stacks
}
);

/*
* RunnersRole:
* Type: 'AWS::IAM::Role'
Expand Down Expand Up @@ -254,20 +242,32 @@ export class GitlabRunnerStack extends Stack {
"ec2:ResourceTag/Name": "*gitlab-docker-machine-*",
},
ArnEquals: {
"ec2:InstanceProfile": "RunnersInstanceProfile.Arn",
"ec2:InstanceProfile": `${runnersInstanceProfile.attrArn}`,
},
},
},
{
Effect: "Allow",
Action: ["iam:PassRole"],
Resource: ["RunnersRole.Arn"],
Resource: [`${runnersRole.roleArn}`],
},
],
}), // TODO: Re-check this
}),
},
});

/*
* ManagerInstanceProfile:
* Type: 'AWS::IAM::InstanceProfile'
*/
const managerInstanceProfile = new CfnInstanceProfile( // TODO: refactor this low level code
this,
"ManagerInstanceProfile",
{
roles: [managerRole.roleName],
}
);

/* Manager:
* Type: 'AWS::EC2::Instance'
*/
Expand Down

0 comments on commit 9fc97cf

Please sign in to comment.