Skip to content

Commit a4dc7a1

Browse files
authored
Merge pull request #4230 from alphagov/add-ckan-output-bucket
Add output bucket to store check links reports
2 parents 4001f32 + 0689e05 commit a4dc7a1

2 files changed

Lines changed: 46 additions & 2 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
locals {
2+
s3_bucket_datagovuk_bucket_name = "govuk-ckan-output-${var.govuk_environment}"
3+
s3_bucket_datagovuk_bucket_arn = "arn:aws:s3:::${local.s3_bucket_datagovuk_bucket_name}"
4+
}
5+
6+
module "s3_bucket_datagovuk_bucket" {
7+
source = "../../shared-modules/s3"
8+
9+
govuk_environment = var.govuk_environment
10+
name = local.s3_bucket_datagovuk_bucket_name
11+
12+
versioning_enabled = true
13+
versioning_suspended = true
14+
15+
enable_public_access_block = true
16+
extra_bucket_policies = [data.aws_iam_policy_document.datagovuk_bucket.json]
17+
18+
tags = {
19+
System = "Data.gov.uk CKAN outputs"
20+
Name = "CKAN Output Bucket for ${var.govuk_environment}"
21+
}
22+
}
23+
24+
# TODO: instead of granting write access to nodes, use IRSA (IAM Roles for
25+
# Service Accounts aka pod identity) so that only Argo CD can write.
26+
data "aws_iam_policy_document" "datagovuk_bucket" {
27+
statement {
28+
sid = "EKSNodesCanList"
29+
principals {
30+
type = "AWS"
31+
identifiers = [data.tfe_outputs.cluster_infrastructure.nonsensitive_values.worker_iam_role_arn]
32+
}
33+
actions = ["s3:ListBucket"]
34+
resources = [local.s3_bucket_datagovuk_bucket_arn]
35+
}
36+
statement {
37+
sid = "EKSNodesCanWrite"
38+
principals {
39+
type = "AWS"
40+
identifiers = [data.tfe_outputs.cluster_infrastructure.nonsensitive_values.worker_iam_role_arn]
41+
}
42+
actions = ["s3:GetObject", "s3:PutObject"]
43+
resources = ["${local.s3_bucket_datagovuk_bucket_arn}/*"]
44+
}
45+
}

terraform/deployments/datagovuk-infrastructure/variables.tf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ variable "organogram_bucket_cors_origins" {
2828
"https://www.integration.data.gov.uk",
2929
"https://find.eks.production.govuk.digital",
3030
"https://find.eks.integration.govuk.digital",
31-
"https://find.eks.staging.govuk.digital",
32-
"https://find.eph-aaa113.ephemeral.govuk.digital"
31+
"https://find.eks.staging.govuk.digital"
3332
]
3433
}
3534

0 commit comments

Comments
 (0)