Skip to content

Commit

Permalink
Allow listing policies that grant RDS connect (#61)
Browse files Browse the repository at this point in the history
* Allow listing policies that grant RDS connect

* add missing brakets

* fix
  • Loading branch information
swiknaba authored Apr 14, 2022
1 parent 8703fbe commit 8b95b42
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions rds/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ locals {
}

# Readonly access to database
# We allow `ListPolicies` to allow filtering all describable instances by those we can connect to
resource "aws_iam_group" "rds-db-connect" {
for_each = toset(local.db_roles)
name = "${var.project}-${var.environment}-rds-db-connect-${each.key}"
Expand All @@ -28,6 +29,16 @@ resource "aws_iam_policy" "rds-db-connect" {
"Resource": [
"arn:aws:rds-db:${var.region}:${var.account_id}:dbuser:${aws_db_instance.main.resource_id}/${var.project}_${var.environment}_${each.key}"
]
},
{
"Effect": "Allow",
"Action": [
"iam:ListPolicies"
],
"Resource": [
"arn:aws:iam::${var.account_id}:policy/${var.project}-${var.environment}-rds-db-connect-*",
"arn:aws:iam::${var.account_id}:policy/${var.project}-${var.environment}-rds-view"
]
}
]
}
Expand Down

0 comments on commit 8b95b42

Please sign in to comment.