Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Beanstalk integ tests #886

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/AWS.Deploy.CLI.IntegrationTests/Helpers/IAMHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ public async Task DeleteRoleAndInstanceProfileAfterBeanstalkEnvionmentDeployment
var role = existingRoles.FirstOrDefault(x => string.Equals(roleName, x.RoleName));
if (role != null)
{
var polices = (await _client.ListAttachedRolePoliciesAsync(new ListAttachedRolePoliciesRequest { RoleName = roleName })).AttachedPolicies;
if (polices != null)
{
foreach(var policy in polices)
{
await _client.DetachRolePolicyAsync(new DetachRolePolicyRequest
{
RoleName = roleName,
PolicyArn = policy.PolicyArn
});
}
}

await _client.RemoveRoleFromInstanceProfileAsync(new RemoveRoleFromInstanceProfileRequest
{
RoleName = roleName,
Expand Down Expand Up @@ -78,6 +91,12 @@ await _client.CreateRoleAsync(new CreateRoleRequest
AssumeRolePolicyDocument = assumeRolepolicyDocument.Replace("'", "\""),
MaxSessionDuration = 7200
});

await _client.AttachRolePolicyAsync(new AttachRolePolicyRequest
{
RoleName = roleName,
PolicyArn = "arn:aws:iam::aws:policy/AWSElasticBeanstalkWebTier"
});
}

InstanceProfile instanceProfile = null;
Expand Down
Loading