Skip to content

Commit d37c275

Browse files
authored
Merge pull request #443 from rust-lang/pa-start-release-perms
Grant permissions to the release team
2 parents 66dd7c1 + 9b0f96a commit d37c275

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed

terragrunt/accounts/root/aws-organization/terragrunt.hcl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ inputs = {
1919
given_name = "Pietro",
2020
family_name = "Albini"
2121
22-
groups = ["infra", "infra-admins"]
22+
groups = ["infra", "infra-admins", "release"]
2323
}
2424
"simulacrum" = {
2525
given_name = "Mark",
2626
family_name = "Rousskov"
2727
28-
groups = ["infra", "infra-admins", "triagebot"]
28+
groups = ["infra", "infra-admins", "release", "triagebot"]
2929
}
3030
"rylev" = {
3131
given_name = "Ryan",

terragrunt/modules/aws-organization/groups.tf

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ resource "aws_identitystore_group" "triagebot" {
4242
description = "The triagebot maintainers"
4343
}
4444

45+
resource "aws_identitystore_group" "release" {
46+
identity_store_id = local.identity_store_id
47+
48+
display_name = "release"
49+
description = "The release team"
50+
}
51+
4552
# The different permission sets a group may have assigned to it
4653

4754
resource "aws_ssoadmin_permission_set" "administrator_access" {
@@ -156,6 +163,69 @@ resource "aws_ssoadmin_permission_set_inline_policy" "triagebot_access" {
156163
permission_set_arn = aws_ssoadmin_permission_set.triagebot_access.arn
157164
}
158165

166+
// Release team permission to start a new release
167+
168+
resource "aws_ssoadmin_permission_set" "start_release" {
169+
instance_arn = local.instance_arn
170+
name = "StartRelease"
171+
}
172+
173+
resource "aws_ssoadmin_permission_set_inline_policy" "start_release" {
174+
instance_arn = local.instance_arn
175+
permission_set_arn = aws_ssoadmin_permission_set.start_release.arn
176+
177+
inline_policy = jsonencode({
178+
Version = "2012-10-17"
179+
Statement = [
180+
{
181+
Effect = "Allow"
182+
Action = "lambda:InvokeFunction"
183+
Resource = "arn:aws:lambda:us-west-1:890664054962:function:start-release"
184+
},
185+
{
186+
Effect = "Allow"
187+
Action = [
188+
"codebuild:StopBuild",
189+
]
190+
Resource = [
191+
"arn:aws:codebuild:us-west-1:890664054962:project/promote-release--dev",
192+
"arn:aws:codebuild:us-west-1:890664054962:project/promote-release--prod",
193+
]
194+
},
195+
{
196+
// This is a safeguard to ensure members of the release team can never
197+
// start any CodeBuild job directly, but rather have to go through the
198+
// lambda. This is because the StartBuild permission not only allows
199+
// starting the build (which would be fine), but also override any part
200+
// of the build definition, including the executed steps.
201+
Effect = "Deny"
202+
Action = "codebuild:StartBuild"
203+
Resource = "*"
204+
},
205+
{
206+
Effect = "Allow"
207+
Action = [
208+
// Subset of CloudwatchReadOnlyAccess
209+
// See https://docs.aws.amazon.com/aws-managed-policy/latest/reference/CloudWatchReadOnlyAccess.html
210+
"logs:Get*",
211+
"logs:List*",
212+
"logs:StartQuery",
213+
"logs:Describe*",
214+
"logs:FilterLogEvents",
215+
"logs:StartLiveTail",
216+
"logs:StopLiveTail",
217+
]
218+
Resource = [
219+
"arn:aws:logs:us-west-1:890664054962:log-group:/dev/promote-release",
220+
"arn:aws:logs:us-west-1:890664054962:log-group:/dev/promote-release:*",
221+
"arn:aws:logs:us-west-1:890664054962:log-group:/prod/promote-release",
222+
"arn:aws:logs:us-west-1:890664054962:log-group:/prod/promote-release:*",
223+
]
224+
},
225+
]
226+
})
227+
}
228+
159229
# The assignment of groups to accounts with their respective permission sets
160230

161231
locals {
@@ -184,6 +254,8 @@ locals {
184254
permissions : [aws_ssoadmin_permission_set.view_only_access] },
185255
{ group : aws_identitystore_group.triagebot,
186256
permissions : [aws_ssoadmin_permission_set.triagebot_access] },
257+
{ group : aws_identitystore_group.release,
258+
permissions : [aws_ssoadmin_permission_set.start_release] },
187259
]
188260
},
189261
# crates-io Staging

terragrunt/modules/aws-organization/users.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ locals {
55
infra-admins : aws_identitystore_group.infra-admins
66
crates-io : aws_identitystore_group.crates_io
77
triagebot : aws_identitystore_group.triagebot
8+
release : aws_identitystore_group.release
89
}
910

1011
# Expand var.users into collection of group memberships associations

0 commit comments

Comments
 (0)