Created
August 2, 2020 03:55
-
-
Save dilunika/f1f095af7d30d5582ef0fe1bdbc63832 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private createPipelineRole(sharedAccountPrincipal: AccountPrincipal) { | |
const pipelineRole = new iam.Role(this, 'DHApiCodepipelineRole', { | |
roleName: `DHApiCodepipelineRole`, | |
assumedBy: new iam.CompositePrincipal( | |
new iam.ServicePrincipal('codepipeline.amazonaws.com'), | |
new iam.ServicePrincipal('codebuild.amazonaws.com'), | |
sharedAccountPrincipal | |
) | |
}); | |
pipelineRole.attachInlinePolicy(new iam.Policy(this, 'SharedAccountAssumeRolePolicy', { | |
policyName: 'SharedAccountAssumeRolePolicy', | |
statements: [ | |
new iam.PolicyStatement({ | |
actions: ['sts:AssumeRole'], | |
resources: ['arn:aws:iam::<shared-account>:role/*'] //TODO Remove hard code | |
}), | |
new iam.PolicyStatement({ | |
sid: 'AdminPermission', | |
effect: iam.Effect.ALLOW, | |
actions: ['*'], | |
resources: ['*'] | |
}) | |
] | |
})); | |
return pipelineRole; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment