Skip to content

Commit b70091c

Browse files
committed
Allow support role to release the lock on state files
We need the support role to be able to `terraform apply`, therefore it needs to be able to get/release the lock on state files. The role also needs to be able to put objects in and get objects from the state file buckets, but we already gave it those permissions as part of allowing it to manage_maintenance_page.
1 parent eb7a2b8 commit b70091c

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

infra/modules/engineer-access/policies.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,4 +310,26 @@ resource "aws_iam_policy" "lock_state_files" {
310310
}
311311
]
312312
})
313+
}
314+
315+
resource "aws_iam_policy" "release_lock_on_state_files" {
316+
name = "release-lock-on-state-files"
317+
path = "/"
318+
319+
description = "Allow releasing the lock on state files"
320+
321+
policy = jsonencode({
322+
Version = "2012-10-17"
323+
Statement = [
324+
{
325+
Action = [
326+
"s3:DeleteOject"
327+
]
328+
Effect = "Allow"
329+
Resource = [
330+
"arn:aws:s3:::gds-forms-${var.environment_type}-tfstate/*.tflock"
331+
]
332+
}
333+
]
334+
})
313335
}

infra/modules/engineer-access/roles.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ module "support_role" {
2929
aws_iam_policy.manage_deployments.arn,
3030
aws_iam_policy.manage_maintenance_page.arn,
3131
aws_iam_policy.lock_state_files.arn,
32+
aws_iam_policy.release_lock_on_state_files.arn,
3233
var.allow_rds_data_api_access ? [aws_iam_policy.query_rds_with_data_api[0].arn] : [],
3334
var.allow_ecs_task_usage ? [aws_iam_policy.run_task[0].arn, aws_iam_policy.stop_task[0].arn] : []
3435
])

0 commit comments

Comments
 (0)