add: iam construct

This commit is contained in:
nsxshota 2023-11-23 12:45:45 +09:00
commit 0695a44a26
3 changed files with 42 additions and 29 deletions

View file

@ -95,19 +95,5 @@ export class BackEndCluster extends Construct {
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS },
});
// Secrets ManagerからのSecret取得ロール
const ecsBackEndExecutionRole = iam.Role.fromRoleArn(
this,
"ecsBackEndExecutionRole",
backendService.taskDefinition.executionRole!.roleArn,
{}
);
ecsBackEndExecutionRole.attachInlinePolicy(new iam.Policy(this, 'SMGetPolicy', {
statements: [new iam.PolicyStatement({
actions: ['secretsmanager:GetSecretValue'],
resources: [secretsDB.secretArn],
})],
}));
}
}