From 442156ecf6aa41c07257b81564de57911d51d2bd Mon Sep 17 00:00:00 2001 From: Audun Nes Date: Thu, 18 Jan 2024 14:59:19 +0100 Subject: [PATCH 1/4] Make scaffold docs more generic for docker run --- tools/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/README.md b/tools/README.md index 7eb9367e..5be59085 100644 --- a/tools/README.md +++ b/tools/README.md @@ -15,5 +15,6 @@ mkdir auto-generated Run docker: ```bash -docker run -v /terraform-aws-rds/:/input -v /terraform-aws-rds/tools/auto-generated/:/output scaffold:latest +cd ../.. +docker run -v $PWD/terraform-aws-rds/:/input -v $PWD/terraform-aws-rds/tools/auto-generated/:/output scaffold:latest ``` From bcb3802020e2b096395bf571cd3bcb77373d27e4 Mon Sep 17 00:00:00 2001 From: Audun Nes Date: Thu, 18 Jan 2024 15:03:47 +0100 Subject: [PATCH 2/4] Fix markdown lints and enhance the scaffolding instructions --- tools/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tools/README.md b/tools/README.md index 5be59085..ef1f7ae3 100644 --- a/tools/README.md +++ b/tools/README.md @@ -1,6 +1,14 @@ -Run docker file: +# Scaffolding guide +Change directory to where you have checked out. + +```bash cd /dfds/terraform-aws-rds/tools +``` + +## Build container image and create required directory + +Build the container image: ```bash docker build -t scaffold . @@ -12,7 +20,9 @@ Create output folder: mkdir auto-generated ``` -Run docker: +## Run container + +Run newly created image: ```bash cd ../.. From 03aea32dbff652784b5f9f65076415b769f16c5e Mon Sep 17 00:00:00 2001 From: Audun Nes Date: Thu, 18 Jan 2024 15:12:20 +0100 Subject: [PATCH 3/4] Add missing ssh executable --- tools/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Dockerfile b/tools/Dockerfile index 1c1e664b..914a23af 100644 --- a/tools/Dockerfile +++ b/tools/Dockerfile @@ -1,7 +1,7 @@ FROM python:slim RUN apt update && \ - apt install -y curl libpq-dev less jq tar unzip + apt install -y curl libpq-dev less jq tar unzip ssh # Adding GitHub public SSH key to known hosts From 5b68dd3813e8b346888ffad41751fe485ee4c7bc Mon Sep 17 00:00:00 2001 From: Audun Nes Date: Thu, 18 Jan 2024 15:13:04 +0100 Subject: [PATCH 4/4] Rename output variable in scaffolding to fit module name --- tools/scaffolding/scripts/generate_tf_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/scaffolding/scripts/generate_tf_module.py b/tools/scaffolding/scripts/generate_tf_module.py index 56b428c9..d51613cb 100644 --- a/tools/scaffolding/scripts/generate_tf_module.py +++ b/tools/scaffolding/scripts/generate_tf_module.py @@ -31,7 +31,7 @@ output_list = [] OUTPUT_TEMPLATE = """output "$out_name" { description = "$output_description" - value = try(module.db_instance_example.$out_value, null) + value = try(module.db_instance.$out_value, null) }""" with open(work_folder, "r", encoding='UTF-8') as f: