File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
test/AWS.Deploy.CLI.IntegrationTests/Helpers Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,19 @@ public async Task DeleteRoleAndInstanceProfileAfterBeanstalkEnvionmentDeployment
3232 var role = existingRoles . FirstOrDefault ( x => string . Equals ( roleName , x . RoleName ) ) ;
3333 if ( role != null )
3434 {
35+ var polices = ( await _client . ListAttachedRolePoliciesAsync ( new ListAttachedRolePoliciesRequest { RoleName = roleName } ) ) . AttachedPolicies ;
36+ if ( polices != null )
37+ {
38+ foreach ( var policy in polices )
39+ {
40+ await _client . DetachRolePolicyAsync ( new DetachRolePolicyRequest
41+ {
42+ RoleName = roleName ,
43+ PolicyArn = policy . PolicyArn
44+ } ) ;
45+ }
46+ }
47+
3548 await _client . RemoveRoleFromInstanceProfileAsync ( new RemoveRoleFromInstanceProfileRequest
3649 {
3750 RoleName = roleName ,
@@ -78,6 +91,12 @@ await _client.CreateRoleAsync(new CreateRoleRequest
7891 AssumeRolePolicyDocument = assumeRolepolicyDocument . Replace ( "'" , "\" " ) ,
7992 MaxSessionDuration = 7200
8093 } ) ;
94+
95+ await _client . AttachRolePolicyAsync ( new AttachRolePolicyRequest
96+ {
97+ RoleName = roleName ,
98+ PolicyArn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"
99+ } ) ;
81100 }
82101
83102 InstanceProfile instanceProfile = null ;
You can’t perform that action at this time.
0 commit comments