Skip to content

Commit 868bd80

Browse files
Timothy Chandlerantonbabenko
authored andcommitted
Feature/rds cluster resource id output (#31)
* Added the Resource ID to outputs. * Updated with information for using this_rds_cluster_resource_id output parameter. * Updated the example with a sample policy using this new output parameter.
1 parent 9cb2598 commit 868bd80

3 files changed

Lines changed: 27 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Terraform documentation is generated automatically using [pre-commit hooks](http
114114
| this\_rds\_cluster\_database\_name | Name for an automatically created database on cluster creation |
115115
| this\_rds\_cluster\_endpoint | The cluster endpoint |
116116
| this\_rds\_cluster\_id | The ID of the cluster |
117+
| this\_rds\_cluster\_resource\_id | The Resource ID of the cluster |
117118
| this\_rds\_cluster\_instance\_endpoints | A list of all cluster instance endpoints |
118119
| this\_rds\_cluster\_master\_password | The master password |
119120
| this\_rds\_cluster\_master\_username | The master username |

examples/mysql/main.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,24 @@ module "vpc" {
7979
"10.0.9.0/25",
8080
]
8181
}
82+
83+
# IAM Policy for use with iam_database_authentication = true
84+
resource "aws_iam_policy" "aurora_mysql_policy_iam_auth" {
85+
name = "test-aurora-db-57-policy-iam-auth"
86+
policy = <<POLICY
87+
{
88+
"Version": "2012-10-17",
89+
"Statement": [
90+
{
91+
"Effect": "Allow",
92+
"Action": [
93+
"rds-db:connect"
94+
],
95+
"Resource": [
96+
"arn:aws:rds-db:us-east-1:123456789012:dbuser:${module.aurora.this_rds_cluster_resource_id}/jane_doe"
97+
]
98+
}
99+
]
100+
}
101+
POLICY
102+
}

outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ output "this_rds_cluster_id" {
44
value = "${aws_rds_cluster.this.id}"
55
}
66

7+
output "this_rds_cluster_resource_id" {
8+
description = "The Resource ID of the cluster"
9+
value = "${aws_rds_cluster.this.cluster_resource_id}"
10+
}
11+
712
output "this_rds_cluster_endpoint" {
813
description = "The cluster endpoint"
914
value = "${aws_rds_cluster.this.endpoint}"

0 commit comments

Comments
 (0)