Commit a328411
authored
fix: grant S3 permissions to Role instead of ManagedPolicy (#396)
The grant_read_write() method was incorrectly called with a ManagedPolicy
instead of a Role. ManagedPolicy does not implement IGrantable and cannot
be used as a Principal in IAM policies. This latent bug was exposed when
CDK 2.174.0 added validation that rejects ManagedPolicy as a principal.
The fix moves the grant call to after the Role is created and targets
the model_execution_role instead of model_execution_policy, aligning
with the pattern used elsewhere in this file and other sagemaker modules.
Fixes: Cannot use a ManagedPolicy as the 'Principal' in an IAM Policy1 parent 1e3af0d commit a328411
2 files changed
Lines changed: 4 additions & 1 deletion
File tree
- modules/sagemaker/sagemaker-templates/templates/model_deploy/seed_code/deploy_app/deploy_app
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | | - | |
138 | 137 | | |
139 | 138 | | |
140 | 139 | | |
| |||
152 | 151 | | |
153 | 152 | | |
154 | 153 | | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
| |||
0 commit comments