-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1795 from alphagov/sengi/timelock
Fix, clean up & update database backups bucket TF.
- Loading branch information
Showing
10 changed files
with
471 additions
and
1,444 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
terraform/projects/infra-database-backups-bucket/.terraform-version
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.6.2 |
242 changes: 98 additions & 144 deletions
242
terraform/projects/infra-database-backups-bucket/README.md
Large diffs are not rendered by default.
Oops, something went wrong.
35 changes: 9 additions & 26 deletions
35
terraform/projects/infra-database-backups-bucket/bucket_policy.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}/*"] | ||
} | ||
} |
Oops, something went wrong.