From 8208b52cab4fcabab1284b325fb27cbf3e144616 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 11 Sep 2024 08:38:05 +0000 Subject: [PATCH] Commit changes made by code formatters --- documentation/rds-bastion.md | 30 ++++++++++++++++++++++--- modules/admin/outputs.tf | 2 +- modules/dhcp/outputs.tf | 2 +- outputs.tf | 2 +- scripts/create_db_connection_details.sh | 3 +-- 5 files changed, 31 insertions(+), 8 deletions(-) diff --git a/documentation/rds-bastion.md b/documentation/rds-bastion.md index f45821e1..0df2b9ad 100644 --- a/documentation/rds-bastion.md +++ b/documentation/rds-bastion.md @@ -31,8 +31,21 @@ Run the Staff-Device-DNS-DHCP-Infrastructure pipeline to create the bastion inst ### Get environment details for the target env +We will need to query the Terraform state for the environment we need to run the init command, which will get then necessary env vars and terraform providers and modules. +For development we do need to add an ENV_ARGUMENT + +``` +make clean +make init +make init +``` + +For pre-production and production we do add the ENV_ARGUMENT as shown below. + ``` -make gen-env ENV_ARGUMENT=production +make clean +make init ENV_ARGUMENT=production +make init ENV_ARGUMENT=production ``` ### run the script to identify the bastion instance id @@ -47,6 +60,18 @@ Then identify the running bastion host i-019174128cf7b4563| t3a.small | None | running | mojo-production-rds-admin-bastion ``` +Alternatively there is another make target that will return the bastion's instance_id if it exists. + +```shell +make instanceid-bastion-rds-admin +``` + +or + +```shell +make instanceid-bastion-rds-server +``` + ### Start session on bastion Run make command with instance id @@ -133,7 +158,7 @@ In order to connect to the database the following items will be needed. - username e.g. `"username": "adminuser"` - password -Connection strings for testing conncetivity and accessing the DBs are described below, however you can obtain ready baked dynamically created versions by running: +Connection strings for testing connectivity and accessing the DBs are described below, however you can obtain ready baked dynamically created versions by running: ```shell make rds-admin @@ -147,7 +172,6 @@ make rds-server-password A file will be created and shown on the terminal with all the correct details for the environment, examples are below. - ### Test connection ```shell diff --git a/modules/admin/outputs.tf b/modules/admin/outputs.tf index 64c2d05f..93bcd2b9 100644 --- a/modules/admin/outputs.tf +++ b/modules/admin/outputs.tf @@ -46,6 +46,6 @@ output "db" { name = aws_db_instance.admin_db.db_name port = aws_db_instance.admin_db.port rds_monitoring_role = aws_iam_role.rds_monitoring_role.arn -# username = aws_db_instance.admin_db.username ## non-secret now coming from Secret Manager, Terraform treats as sensitive. + # username = aws_db_instance.admin_db.username ## non-secret now coming from Secret Manager, Terraform treats as sensitive. } } diff --git a/modules/dhcp/outputs.tf b/modules/dhcp/outputs.tf index 259a74ad..d15e626d 100644 --- a/modules/dhcp/outputs.tf +++ b/modules/dhcp/outputs.tf @@ -88,7 +88,7 @@ output "db" { id = aws_db_instance.dhcp_server_db.id name = aws_db_instance.dhcp_server_db.db_name port = aws_db_instance.dhcp_server_db.port -# username = aws_db_instance.dhcp_server_db.username ## non-secret now coming from Secret Manager, Terraform treats as sensitive. + # username = aws_db_instance.dhcp_server_db.username ## non-secret now coming from Secret Manager, Terraform treats as sensitive. } } diff --git a/outputs.tf b/outputs.tf index a0e11af2..159ad101 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,5 +1,5 @@ output "terraform_outputs" { -# sensitive = true + # sensitive = true value = { dhcp = { ecs = module.dhcp.ecs diff --git a/scripts/create_db_connection_details.sh b/scripts/create_db_connection_details.sh index a1ff6145..e716f6b1 100755 --- a/scripts/create_db_connection_details.sh +++ b/scripts/create_db_connection_details.sh @@ -34,11 +34,10 @@ filename="\`date "+%Y_%m_%d-%H_%M_%S"\`_${ENV}_${admin_db_name}_rds-dump.sql"; \ mysqldump \\ -u "${admin_db_username}" \\ -p \\ - --ssl \\ --set-gtid-purged=OFF \\ --triggers --routines --events \\ -h "${admin_db_fqdn}" \\ - "${admin_db_name}" > ~/${filename}; \\ + "${admin_db_name}" > ~/\${filename}; \\ ls -al; \\ aws s3 cp ~/\${filename} s3://mojo-file-transfer/ --profile s3-role; \\ aws s3 ls s3://mojo-file-transfer/ --profile s3-role;