Skip to content
Merged
8 changes: 6 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ locals {

data "aws_region" "current" {}
data "aws_partition" "current" {}

data "aws_service_principal" "rds" {
count = var.create && var.create_iam_role ? 1 : 0
service_name = "rds"
region = data.aws_region.current.name
}
################################################################################
# RDS Proxy
################################################################################
Expand Down Expand Up @@ -111,7 +115,7 @@ data "aws_iam_policy_document" "assume_role" {

principals {
type = "Service"
identifiers = ["rds.${data.aws_partition.current.dns_suffix}"]
identifiers = [data.aws_service_principal.rds[0].name]
}
}
}
Expand Down