From 8cd4db1d3b3794bae130a394621ac09c8ef7a83f Mon Sep 17 00:00:00 2001 From: Dane H Lim Date: Wed, 27 Mar 2024 15:36:47 -0700 Subject: [PATCH] Setup ECS config directory if not present --- al1.pkr.hcl | 4 ++++ al2.pkr.hcl | 4 ++++ al2023.pkr.hcl | 4 ++++ scripts/setup-ecs-config-dir.sh | 12 ++++++++++++ 4 files changed, 24 insertions(+) create mode 100644 scripts/setup-ecs-config-dir.sh diff --git a/al1.pkr.hcl b/al1.pkr.hcl index 7a6c64be..58705ad9 100644 --- a/al1.pkr.hcl +++ b/al1.pkr.hcl @@ -89,6 +89,10 @@ build { destination = "/tmp/additional-packages" } + provisioner "shell" { + script = "scripts/setup-ecs-config-dir.sh" + } + provisioner "shell" { inline_shebang = "/bin/sh -ex" inline = [ diff --git a/al2.pkr.hcl b/al2.pkr.hcl index a26338ca..7929281a 100644 --- a/al2.pkr.hcl +++ b/al2.pkr.hcl @@ -103,6 +103,10 @@ build { ] } + provisioner "shell" { + script = "scripts/setup-ecs-config-dir.sh" + } + provisioner "shell" { script = "scripts/install-docker.sh" environment_vars = [ diff --git a/al2023.pkr.hcl b/al2023.pkr.hcl index ac2c6cc1..e8ee038a 100644 --- a/al2023.pkr.hcl +++ b/al2023.pkr.hcl @@ -83,6 +83,10 @@ build { ] } + provisioner "shell" { + script = "scripts/setup-ecs-config-dir.sh" + } + provisioner "shell" { script = "scripts/install-docker.sh" environment_vars = [ diff --git a/scripts/setup-ecs-config-dir.sh b/scripts/setup-ecs-config-dir.sh new file mode 100644 index 00000000..7c82bb47 --- /dev/null +++ b/scripts/setup-ecs-config-dir.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -ex + +sudo mkdir -p "/etc/ecs" + +if [ ! -f "/etc/ecs/ecs.config" ]; then + sudo touch /etc/ecs/ecs.config +fi + +if [ ! -f "/etc/ecs/ecs.config.json" ]; then + sudo touch /etc/ecs/ecs.config.json +fi \ No newline at end of file