From 5ed286f1fe29ea7b85f45dcd502ca49c41841a4c Mon Sep 17 00:00:00 2001 From: Anton Babenko Date: Wed, 31 Jan 2018 09:46:12 +0100 Subject: [PATCH] Fixed outputs for #36 --- examples/complete/mysql/main.tf | 3 +++ modules/db_instance/outputs.tf | 24 ++++++++++++------------ variables.tf | 12 ++++++------ 3 files changed, 21 insertions(+), 18 deletions(-) diff --git a/examples/complete/mysql/main.tf b/examples/complete/mysql/main.tf index e0e7506f..37916707 100644 --- a/examples/complete/mysql/main.tf +++ b/examples/complete/mysql/main.tf @@ -26,6 +26,9 @@ module "db" { identifier = "demodb" + create_db_instance = false + create_db_subnet_group = false + # All available versions: http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_MySQL.html#MySQL.Concepts.VersionMgmt engine = "mysql" engine_version = "5.7.19" diff --git a/modules/db_instance/outputs.tf b/modules/db_instance/outputs.tf index b694863b..c2e65b38 100644 --- a/modules/db_instance/outputs.tf +++ b/modules/db_instance/outputs.tf @@ -1,60 +1,60 @@ # DB instance output "this_db_instance_address" { description = "The address of the RDS instance" - value = "${element(concat(aws_db_instance.this.address, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.address, list("")), 0)}" } output "this_db_instance_arn" { description = "The ARN of the RDS instance" - value = "${element(concat(aws_db_instance.this.arn, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.arn, list("")), 0)}" } output "this_db_instance_availability_zone" { description = "The availability zone of the RDS instance" - value = "${element(concat(aws_db_instance.this.availability_zone, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.availability_zone, list("")), 0)}" } output "this_db_instance_endpoint" { description = "The connection endpoint" - value = "${element(concat(aws_db_instance.this.endpoint, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.endpoint, list("")), 0)}" } output "this_db_instance_hosted_zone_id" { description = "The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)" - value = "${element(concat(aws_db_instance.this.hosted_zone_id, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.hosted_zone_id, list("")), 0)}" } output "this_db_instance_id" { description = "The RDS instance ID" - value = "${element(concat(aws_db_instance.this.id, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.id, list("")), 0)}" } output "this_db_instance_resource_id" { description = "The RDS Resource ID of this instance" - value = "${element(concat(aws_db_instance.this.resource_id, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.resource_id, list("")), 0)}" } output "this_db_instance_status" { description = "The RDS instance status" - value = "${element(concat(aws_db_instance.this.status, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.status, list("")), 0)}" } output "this_db_instance_name" { description = "The database name" - value = "${element(concat(aws_db_instance.this.name, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.name, list("")), 0)}" } output "this_db_instance_username" { description = "The master username for the database" - value = "${element(concat(aws_db_instance.this.username, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.username, list("")), 0)}" } output "this_db_instance_password" { description = "The database password (this password may be old, because Terraform doesn't track it after initial creation)" - value = "${element(concat(var.password, list("")), 0)}" + value = "${var.password}" } output "this_db_instance_port" { description = "The database port" - value = "${element(concat(aws_db_instance.this.port, list("")), 0)}" + value = "${element(concat(aws_db_instance.this.*.port, list("")), 0)}" } diff --git a/variables.tf b/variables.tf index a5102a6f..cbb737e0 100644 --- a/variables.tf +++ b/variables.tf @@ -186,16 +186,16 @@ variable "parameters" { } variable "create_db_subnet_group" { - description = "Create a database subnet group" - default = 1 + description = "Whether to create a database subnet group" + default = true } variable "create_db_parameter_group" { - description = "Create a database parameter group" - default = 1 + description = "Whether to create a database parameter group" + default = true } variable "create_db_instance" { - description = "Create a database instance" - default = 1 + description = "Whether to create a database instance" + default = true }