From 9af05a80cde752c95fc584534bb71227aa06a861 Mon Sep 17 00:00:00 2001 From: "Sergey.Kesarev" Date: Mon, 22 Jul 2024 19:03:18 +0200 Subject: [PATCH 1/3] Add rds identifier and arn in output --- outputs.tf | 18 +++++++++++++++++- variables.tf | 8 +++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/outputs.tf b/outputs.tf index 7c11740..201578e 100644 --- a/outputs.tf +++ b/outputs.tf @@ -25,6 +25,22 @@ output "hosted_zone_id" { } output "rds_id" { + /* + Deprecated: + Since aws provider v5.0.0 `aws_db_instance.id` returns resource id instead of instance id. + Consider to use `rds_identifier` or `rds_arn` instead. + For the details see https://github.com/hashicorp/terraform-provider-aws/pull/31232. + */ + description = "RDS Resource ID (for aws provider >= v5.0.0) or instance id (for aws provider < v5.0.0)." + value = local.resource_id +} + +output "rds_arn" { + description = "The RDS ARN" + value = local.arn +} + +output "rds_identifier" { description = "The RDS instance ID" - value = local.rds_id + value = local.identifier } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 4b14479..28733e6 100644 --- a/variables.tf +++ b/variables.tf @@ -137,10 +137,12 @@ locals { vpc_id = data.aws_subnet.default.vpc_id address = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.address) : join("", aws_db_instance.parameterized.*.address) hosted_zone_id = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.hosted_zone_id) : join("", aws_db_instance.parameterized.*.hosted_zone_id) - rds_id = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.id) : join("", aws_db_instance.parameterized.*.id) + resource_id = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.id) : join("", aws_db_instance.parameterized.*.id) + identifier = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.identifier) : join("", aws_db_instance.parameterized.*.identifier) + arn = local.parameter_group_name == "" ? join("", aws_db_instance.default.*.arn) : join("", aws_db_instance.parameterized.*.arn) storage_type = var.storage_type iam_database_authentication_enabled = var.iam_database_authentication_enabled - logs_set = compact([ + logs_set = compact([ var.enable_audit_log ? "audit" : "", var.enable_error_log ? "error" : "", var.enable_general_log ? "general" : "", @@ -148,7 +150,7 @@ locals { ]) enhanced_monitoring_interval = var.enhanced_monitoring_interval performance_insights_enabled = var.performance_insights_enabled - tags = merge({ + tags = merge({ Name = var.name, Module = "RDS MySQL" ModuleVersion = "v0.5.0" From 4417b2af8eefc08f56d7f522f37fd9254b2da61a Mon Sep 17 00:00:00 2001 From: "Sergey.Kesarev" Date: Fri, 2 Aug 2024 17:38:57 +0200 Subject: [PATCH 2/3] Add rds identifier and arn in output --- outputs.tf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/outputs.tf b/outputs.tf index 201578e..98523f9 100644 --- a/outputs.tf +++ b/outputs.tf @@ -35,6 +35,11 @@ output "rds_id" { value = local.resource_id } +output "rds_resource_id" { + description = "RDS Resource ID" + value = local.resource_id +} + output "rds_arn" { description = "The RDS ARN" value = local.arn From 70c4e7d3331cf11bab408b812420c4ab8e1d3b99 Mon Sep 17 00:00:00 2001 From: "Sergey.Kesarev" Date: Fri, 2 Aug 2024 17:52:57 +0200 Subject: [PATCH 3/3] bump version --- variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/variables.tf b/variables.tf index 28733e6..e1fdd0b 100644 --- a/variables.tf +++ b/variables.tf @@ -153,7 +153,7 @@ locals { tags = merge({ Name = var.name, Module = "RDS MySQL" - ModuleVersion = "v0.5.0" + ModuleVersion = "v0.5.1" ModuleSource = "https://github.com/jetbrains-infra/terraform-aws-rds-mysql" }, var.tags) } \ No newline at end of file