From c7bb3b6ce298fce814d0a7b24f1da0bdbd75e7cd Mon Sep 17 00:00:00 2001 From: Sofia Podolskaia <86597056+dnillovna@users.noreply.github.com> Date: Thu, 11 Apr 2024 11:38:35 +0300 Subject: [PATCH] Outputs: Add DB and S3 endpoint information (#79) * Outputs: Add DB and S3 endpoint information * RDS: DNS name - db * Outputs: Datagrok internal API endpoint * Outputs: Datagrok internal API endpoint * GitHub Actions: Refactor: Automated formatting of terraform code (#86) Co-authored-by: dnillovna * Revert "GitHub Actions: Refactor: Automated formatting of terraform code (#86)" This reverts commit ee2e241cb728b3e9b2edca51176db72b0c18638c. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dnillovna --- aws/db.tf | 3 +-- aws/outputs.tf | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/aws/db.tf b/aws/db.tf index f19bab7..ea42d23 100644 --- a/aws/db.tf +++ b/aws/db.tf @@ -84,9 +84,8 @@ module "db" { resource "aws_route53_record" "db_private_dns" { count = var.create_route53_internal_zone ? 1 : 0 zone_id = aws_route53_zone.internal[0].zone_id - name = "public_db.${aws_route53_zone.internal[0].name}" + name = "db.${aws_route53_zone.internal[0].name}" type = "CNAME" ttl = 60 records = [split(":", module.db.db_instance_endpoint)[0]] - } diff --git a/aws/outputs.tf b/aws/outputs.tf index ce34983..3b4526e 100644 --- a/aws/outputs.tf +++ b/aws/outputs.tf @@ -43,6 +43,16 @@ output "s3_name" { value = local.s3_name } +output "s3_bucket_name" { + description = "The S3 Bucket name of a stand." + value = local.s3_name +} + +output "s3_bucket_region" { + description = "The S3 Bucket region for a stand." + value = data.aws_region.current.name +} + output "ec2_name" { description = "The EC2 instance name of a stand." value = var.ecs_launch_type == "EC2" ? local.ec2_name : "" @@ -162,3 +172,33 @@ output "alb_internal_arn" { description = "The ARN of the external Application Load balancer" value = module.lb_int.lb_arn } + +output "datagrok_internal_endpoint" { + description = "The internal Datagrok endpoint" + value = module.lb_int.lb_dns_name +} + +output "datagrok_internal_api" { + description = "The internal Datagrok API endpoint" + value = "http://${module.lb_int.lb_dns_name}/api" +} + +output "db_instance_address" { + description = "The address of the Datagrok DB" + value = try(aws_route53_record.db_private_dns[0].name, module.db.db_instance_address) +} + +output "db_instance_port" { + description = "The port of the Datagrok DB" + value = tonumber(module.db.db_instance_port) +} + +output "db_dg_login" { + description = "The user to the Datagrok DB" + value = "datagrok" +} + +output "db_dg_password" { + description = "The password to the Datagrok DB" + value = try(random_password.db_datagrok_password[0].result, var.rds_dg_password) +}