Skip to content

Commit 5019869

Browse files
authored
Merge pull request #5 from codinglabsau/steve/lpb-173-add-ivs-policy-to-yolo
attach multiple managed policies
2 parents ccd9804 + 21f38b0 commit 5019869

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/Steps/Iam/AttachRolePoliciesStep.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
class AttachRolePoliciesStep implements Step
1212
{
13+
protected array $managedPolicies = [
14+
'arn:aws:iam::aws:policy/AmazonElasticTranscoder_JobsSubmitter',
15+
'arn:aws:iam::aws:policy/IVSFullAccess',
16+
];
17+
1318
public function __invoke(array $options): StepResult
1419
{
1520
if (! Arr::get($options, 'dry-run')) {
@@ -21,10 +26,12 @@ public function __invoke(array $options): StepResult
2126
'PolicyArn' => $policy['Arn'],
2227
]);
2328

24-
Aws::iam()->attachRolePolicy([
25-
'RoleName' => $role['RoleName'],
26-
'PolicyArn' => 'arn:aws:iam::aws:policy/AmazonElasticTranscoder_JobsSubmitter',
27-
]);
29+
foreach ($this->managedPolicies as $policyArn) {
30+
Aws::iam()->attachRolePolicy([
31+
'RoleName' => $role['RoleName'],
32+
'PolicyArn' => $policyArn,
33+
]);
34+
}
2835

2936
return StepResult::SYNCED;
3037
}

0 commit comments

Comments
 (0)