Skip to content

Commit 7217651

Browse files
fix: replace string service principal with datasource to get rid of malformed policy error in China partition
1 parent 1fc2397 commit 7217651

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ locals {
66

77
data "aws_region" "current" {}
88
data "aws_partition" "current" {}
9-
9+
data "aws_service_principal" "rds" {
10+
service_name = "rds"
11+
region = data.aws_region.current.region
12+
}
1013
################################################################################
1114
# RDS Proxy
1215
################################################################################
@@ -111,7 +114,7 @@ data "aws_iam_policy_document" "assume_role" {
111114

112115
principals {
113116
type = "Service"
114-
identifiers = distinct(["rds.${data.aws_partition.current.dns_suffix}", "rds.amazonaws.com"])
117+
identifiers = [data.aws_service_principal.rds.id]
115118
}
116119
}
117120
}

0 commit comments

Comments
 (0)