Skip to content

Commit

Permalink
fix: Allow dbx storage credentials roles to be self-assuming (#620)
Browse files Browse the repository at this point in the history
  • Loading branch information
jayengee authored Aug 19, 2024
1 parent 47bf936 commit 47970b3
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions databricks-catalog-external-location/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ data "aws_iam_policy_document" "databricks_external_location_assume_role" {
values = [var.databricks_external_id]
}
}

statement {
principals {
type = "AWS"
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}

actions = ["sts:AssumeRole"]
condition {
test = "ArnEquals"
variable = "aws:PrincipalArn"

values = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:role${local.path}${local.iam_role_name}"]
}
}
}

resource "aws_iam_role" "databricks_external_location_iam_role" {
Expand Down Expand Up @@ -98,6 +113,17 @@ data "aws_iam_policy_document" "databricks_external_location_bucket_access" {
module.catalog_bucket.arn,
]
}

statement {
sid = "databricksAssumeRole"
effect = "Allow"
actions = [
"sts:AssumeRole"
]
resources = [
"arn:aws:iam::${data.aws_caller_identity.current.account_id}:role${local.path}${local.iam_role_name}"
]
}
}

### Policies to access bucket
Expand Down

0 comments on commit 47970b3

Please sign in to comment.