File tree Expand file tree Collapse file tree
adminforth/documentation/blog
2024-10-31-compose-ec2-deployment
2024-11-14-compose-ec2-deployment-ci
2025-02-19-compose-aws-ec2-ecr-terraform-github-actions
2025-02-19-compose-ec2-deployment-github-actions-registry
2025-11-04-k3s-ec2-deployment Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -210,6 +210,8 @@ resource "null_resource" "sync_files_and_run" {
210210 provisioner "local-exec" {
211211 # heredoc syntax
212212 command = <<-EOF
213+ set -eu
214+
213215 rsync -t -av \
214216 --delete \
215217 --exclude 'node_modules' \
Original file line number Diff line number Diff line change @@ -255,6 +255,8 @@ resource "null_resource" "sync_files_and_run" {
255255 # heredoc syntax
256256 # remove files that where deleted on the source
257257 command = <<-EOF
258+ set -eu
259+
258260 # -o StrictHostKeyChecking=no
259261 rsync -t -av -e "ssh -i ./.keys/id_rsa -o StrictHostKeyChecking=no" \
260262 --delete \
Original file line number Diff line number Diff line change @@ -480,6 +480,8 @@ resource "null_resource" "sync_files_and_run" {
480480
481481 provisioner "local-exec" {
482482 command = <<-EOF
483+ set -eu
484+
483485 aws ecr get-login-password --region ${local.aws_region} --profile myaws | docker login --username AWS --password-stdin ${aws_ecr_repository.myadmin_repo.repository_url}
484486
485487 echo "Running build"
Original file line number Diff line number Diff line change @@ -337,6 +337,8 @@ resource "null_resource" "wait_for_user_data" {
337337resource "null_resource" "setup_registry" {
338338 provisioner "local-exec" {
339339 command = <<-EOF
340+ set -eu
341+
340342 echo "Generating secret for local registry"
341343 sha256sum ./.keys/id_rsa | cut -d ' ' -f1 | tr -d '\n ' > ./.keys/registry.pure
342344
@@ -396,6 +398,7 @@ resource "null_resource" "sync_files_and_run" {
396398
397399 provisioner "local-exec" {
398400 command = <<-EOF
401+ set -eu
399402
400403 # map appserver.local to the instance (in CI we don't know the IP, so have to use this mapping)
401404 # so then in GA pipeline we will use
Original file line number Diff line number Diff line change @@ -232,6 +232,8 @@ resource "null_resource" "wait_ssh" {
232232 provisioner "local-exec" {
233233 command = <<EOT
234234 bash -c '
235+ set -eu
236+
235237 for i in {1..10}; do
236238 nc -zv ${aws_instance.ec2_instance.public_ip} 22 && echo "SSH is ready!" && exit 0
237239 sleep 5
@@ -258,7 +260,7 @@ resource "null_resource" "ansible_provision" {
258260 interpreter = ["/bin/bash", "-c"]
259261
260262 command = <<-EOT
261- set -e
263+ set -eu
262264 ANSIBLE_HOST_KEY_CHECKING=False ansible-galaxy collection install community.kubernetes
263265 ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i ${path.module}/../ansible/inventory.ini ${local.ansible_dir}/playbook.yaml
264266 EOT
@@ -294,7 +296,7 @@ resource "null_resource" "docker_build_and_push" {
294296
295297 provisioner "local-exec" {
296298 command = <<-EOT
297- set -e
299+ set -eu
298300 unset DOCKER_HOST
299301
300302 REPO_URL="${aws_ecr_repository.app_repo.repository_url}"
You can’t perform that action at this time.
0 commit comments