Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tf-unimelb): grant data mover role permissions #508

Merged
merged 2 commits into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions terraform/stacks/unimelb/data_archive/analysis_archive.tf
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ data "aws_iam_policy_document" "analysis_archive" {
"${aws_s3_bucket.analysis_archive.arn}/*",
]
}

# Allow the data mover access to copy to this bucket.
statement {
sid = "orcabus_data_mover_access"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.account_id_prod}:role/${local.orcabus_data_mover_role}"]
}
actions = [
# List is needed for aws s3 sync
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectTagging",
"s3:PutObjectVersionTagging"
]
resources = [
aws_s3_bucket.analysis_archive.arn,
"${aws_s3_bucket.analysis_archive.arn}/*",
]
}
}

# ------------------------------------------------------------------------------
Expand Down
78 changes: 78 additions & 0 deletions terraform/stacks/unimelb/data_archive/byob_ica_v2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ locals {
event_bus_arn_umccr_prod_default = "arn:aws:events:ap-southeast-2:${local.account_id_prod}:event-bus/default"
# The role that the orcabus file manager uses to ingest events.
orcabus_file_manager_ingest_role = "orcabus-file-manager-ingest-role"
orcabus_data_mover_role = "orcabus-data-mover-role"
}


Expand Down Expand Up @@ -165,6 +166,27 @@ data "aws_iam_policy_document" "production_data" {
]
}

statement {
sid = "orcabus_data_mover_access"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.account_id_prod}:role/${local.orcabus_data_mover_role}"]
}
actions = [
"s3:ListBucket",
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetObjectTagging",
"s3:GetObjectVersionTagging",
# Also need delete object for moves
"s3:DeleteObject"
]
resources = [
aws_s3_bucket.production_data.arn,
"${aws_s3_bucket.production_data.arn}/*",
]
}

statement {
sid = "data_portal_access"
principals {
Expand Down Expand Up @@ -423,6 +445,34 @@ data "aws_iam_policy_document" "staging_data" {
"${aws_s3_bucket.staging_data.arn}/*",
]
}

statement {
sid = "orcabus_data_mover_access"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.account_id_stg}:role/${local.orcabus_data_mover_role}"]
}
actions = [
"s3:ListBucket",
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetObjectTagging",
"s3:GetObjectVersionTagging",
# Also need delete object for moves
"s3:DeleteObject",
# For dev/staging allow moving to the same bucket for testing.
"s3:PutObject",
"s3:PutObjectTagging",
"s3:PutObjectVersionTagging",
# List is needed for aws s3 sync
"s3:ListBucket"
]
resources = [
aws_s3_bucket.staging_data.arn,
"${aws_s3_bucket.staging_data.arn}/*",
]
}

statement {
sid = "nextflow_batch"
principals {
Expand Down Expand Up @@ -648,6 +698,34 @@ data "aws_iam_policy_document" "development_data" {
"${aws_s3_bucket.development_data.arn}/*",
]
}

statement {
sid = "orcabus_data_mover_access"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.account_id_dev}:role/${local.orcabus_data_mover_role}"]
}
actions = [
"s3:ListBucket",
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetObjectTagging",
"s3:GetObjectVersionTagging",
# Also need delete object for moves
"s3:DeleteObject",
# For dev/staging allow moving to the same bucket for testing.
"s3:PutObject",
"s3:PutObjectTagging",
"s3:PutObjectVersionTagging",
# List is needed for aws s3 sync
"s3:ListBucket"
]
resources = [
aws_s3_bucket.development_data.arn,
"${aws_s3_bucket.development_data.arn}/*",
]
}

statement {
sid = "data_portal_access"
principals {
Expand Down
21 changes: 21 additions & 0 deletions terraform/stacks/unimelb/data_archive/fastq_archive.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,27 @@ data "aws_iam_policy_document" "fastq_archive" {
"${aws_s3_bucket.fastq_archive.arn}/*"
]
}

# Allow the data mover access to copy to this bucket.
statement {
sid = "orcabus_data_mover_access"
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${local.account_id_prod}:role/${local.orcabus_data_mover_role}"]
}
actions = [
# List is needed for aws s3 sync
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectTagging",
"s3:PutObjectVersionTagging"
]
resources = [
aws_s3_bucket.fastq_archive.arn,
"${aws_s3_bucket.fastq_archive.arn}/*"
]
}

# Statement to allow access to any principal from the prod account
statement {
sid = "umccr_prod_account_access"
Expand Down