-
Notifications
You must be signed in to change notification settings - Fork 1
/
rds_outputs.tf
58 lines (50 loc) · 2.53 KB
/
rds_outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
output "rds_instance_address" {
description = "The address of the RDS instance"
value = element(concat(aws_db_instance.this.*.address, aws_db_instance.snapshot.*.address, [""]), 0)
}
output "rds_instance_arn" {
description = "The ARN of the RDS instance"
value = element(concat(aws_db_instance.this.*.arn, aws_db_instance.snapshot.*.arn, [""]), 0)
}
output "rds_instance_endpoint" {
description = "The connection endpoint"
value = element(concat(aws_db_instance.this.*.endpoint, aws_db_instance.snapshot.*.endpoint, [""]), 0)
}
output "rds_instance_id" {
description = "The RDS instance ID"
value = element(concat(aws_db_instance.this.*.id, aws_db_instance.snapshot.*.id, [""]), 0)
}
output "rds_db_name" {
description = "The name of the rds database"
value = element(concat(aws_db_instance.this.*.db_name, aws_db_instance.snapshot.*.name, [""]), 0)
}
output "rds_db_user" {
description = "The RDS db username"
value = element(concat(aws_db_instance.this.*.username, aws_db_instance.snapshot.*.username, [""]), 0)
}
output "rds_db_url" {
description = "The connection url in the format of `engine`://`user`:`password`@`endpoint`/`db_name`"
value = element(concat(aws_db_instance.this.*.username, aws_db_instance.snapshot.*.username, [""]), 0) == "" ? "" : format(
"%s://%s:%s@%s/%s",
var.rds_engine,
element(concat(aws_db_instance.this.*.username, aws_db_instance.snapshot.*.username, [""]), 0),
var.rds_password,
element(concat(aws_db_instance.this.*.endpoint, aws_db_instance.snapshot.*.endpoint, [""]), 0),
element(concat(aws_db_instance.this.*.db_name, aws_db_instance.snapshot.*.name, [""]), 0),
)
}
output "rds_db_url_encoded" {
description = "The connection url in the format of `engine`://`user`:`ulrencode(password)`@`endpoint`/`db_name`"
value = element(concat(aws_db_instance.this.*.username, aws_db_instance.snapshot.*.username, [""]), 0) == "" ? "" : format(
"%s://%s:%s@%s/%s",
var.rds_engine,
element(concat(aws_db_instance.this.*.username, aws_db_instance.snapshot.*.username, [""]), 0),
urlencode(var.rds_password),
element(concat(aws_db_instance.this.*.endpoint, aws_db_instance.snapshot.*.endpoint, [""]), 0),
element(concat(aws_db_instance.this.*.db_name, aws_db_instance.snapshot.*.name, [""]), 0),
)
}
output "rds_engine_version" {
description = "The actual engine version used by the RDS instance."
value = element(concat(aws_db_instance.this[*].engine_version_actual, aws_db_instance.snapshot[*].engine_version_actual, [""]), 0)
}