Skip to content

Commit

Permalink
Merge pull request #1795 from alphagov/sengi/timelock
Browse files Browse the repository at this point in the history
Fix, clean up & update database backups bucket TF.
  • Loading branch information
sengi authored Nov 1, 2023
2 parents d734223 + a98af34 commit 27b7bba
Show file tree
Hide file tree
Showing 10 changed files with 471 additions and 1,444 deletions.
34 changes: 0 additions & 34 deletions terraform/policies/s3_backup_replica_policy.json

This file was deleted.

13 changes: 0 additions & 13 deletions terraform/policies/s3_backup_replica_role.tpl

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.6.2
242 changes: 98 additions & 144 deletions terraform/projects/infra-database-backups-bucket/README.md

Large diffs are not rendered by default.

35 changes: 9 additions & 26 deletions terraform/projects/infra-database-backups-bucket/bucket_policy.tf
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@
/**
* ## Project: database-backups-bucket
*
* Create a policy that allows listing and reading of the database-backups bucket.
*
*/

resource "aws_s3_bucket_policy" "database_backups_cross_account_access" {
bucket = "${aws_s3_bucket.database_backups.id}"
policy = "${data.aws_iam_policy_document.database_backups_cross_account_access.json}"
resource "aws_s3_bucket_policy" "cross_account_access" {
bucket = aws_s3_bucket.main.id
policy = data.aws_iam_policy_document.cross_account_access.json
}

data "aws_iam_policy_document" "database_backups_cross_account_access" {
data "aws_iam_policy_document" "cross_account_access" {
statement {
sid = "CrossAccountPermissions"
effect = "Allow"

principals {
type = "AWS"

identifiers = [
"arn:aws:iam::210287912431:root",
"arn:aws:iam::696911096973:root",
"arn:aws:iam::172025368201:root",
"arn:aws:iam::291968922021:root",
"210287912431", # integration
"696911096973", # staging
"172025368201", # production
]
}

actions = ["s3:Get*", "s3:List*"]

resources = [
"arn:aws:s3:::${aws_s3_bucket.database_backups.id}",
"arn:aws:s3:::${aws_s3_bucket.database_backups.id}/*",
]
actions = ["s3:Get*", "s3:List*"]
resources = [aws_s3_bucket.main.arn, "${aws_s3_bucket.main.arn}/*"]
}
}
Loading

0 comments on commit 27b7bba

Please sign in to comment.