Skip to content

Commit bbbf50c

Browse files
vladislav-orlovskiybryantbiggsantonbabenko
authored
fix: Correct service principal to rds.amazonaws.com (incl China) (#32)
Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com> Co-authored-by: Anton Babenko <anton@antonbabenko.com>
1 parent 99df7e3 commit bbbf50c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ No modules.
9191
| [aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document) | data source |
9292
| [aws_partition.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/partition) | data source |
9393
| [aws_region.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/region) | data source |
94+
| [aws_service_principal.rds](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/service_principal) | data source |
9495

9596
## Inputs
9697

main.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ locals {
66

77
data "aws_region" "current" {}
88
data "aws_partition" "current" {}
9+
data "aws_service_principal" "rds" {
10+
count = var.create && var.create_iam_role ? 1 : 0
911

12+
service_name = "rds"
13+
region = data.aws_region.current.name
14+
}
1015
################################################################################
1116
# RDS Proxy
1217
################################################################################
@@ -111,7 +116,7 @@ data "aws_iam_policy_document" "assume_role" {
111116

112117
principals {
113118
type = "Service"
114-
identifiers = ["rds.${data.aws_partition.current.dns_suffix}"]
119+
identifiers = [data.aws_service_principal.rds[0].name]
115120
}
116121
}
117122
}

0 commit comments

Comments
 (0)