fix: increase permissions and return to directory (#122)

Signed-off-by: matttrach <matt.trachier@suse.com>
This commit is contained in:
Matt Trachier 2025-10-08 12:03:02 -05:00 committed by GitHub
parent 3c161fb1f6
commit c3f2da99e2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 21 additions and 13 deletions

View File

@ -1,8 +1,10 @@
set -x set -x
DIR=$(pwd)
cd ${deploy_path} cd ${deploy_path}
pwd pwd
ls -lah ls -lah
. envrc whoami
. ${deploy_path}/envrc
TF_CLI_ARGS_init="" TF_CLI_ARGS_init=""
TF_CLI_ARGS_apply="" TF_CLI_ARGS_apply=""
@ -54,5 +56,5 @@ if [ $EXITCODE -eq 0 ]; then
echo "success..."; echo "success...";
terraform output -json -state="${deploy_path}/tfstate" > ${deploy_path}/outputs.json terraform output -json -state="${deploy_path}/tfstate" > ${deploy_path}/outputs.json
fi fi
cd $DIR
exit $EXITCODE exit $EXITCODE

View File

@ -1,8 +1,10 @@
set -x set -x
DIR=$(pwd)
cd ${deploy_path} cd ${deploy_path}
pwd pwd
ls -lah ls -lah
. envrc whoami
. ${deploy_path}/envrc
TF_CLI_ARGS_init="" TF_CLI_ARGS_init=""
TF_CLI_ARGS_apply="" TF_CLI_ARGS_apply=""
if [ -z "${skip_destroy}" ]; then if [ -z "${skip_destroy}" ]; then
@ -11,3 +13,5 @@ if [ -z "${skip_destroy}" ]; then
else else
echo "Not destroying deployed module, it will no longer be managed here." echo "Not destroying deployed module, it will no longer be managed here."
fi fi
cd $DIR
exit 0

View File

@ -31,7 +31,6 @@ resource "file_local_directory" "deploy_path" {
path = local.deploy_path path = local.deploy_path
permissions = "0755" permissions = "0755"
} }
resource "file_local_directory" "tf_data_dir" { resource "file_local_directory" "tf_data_dir" {
count = (local.tf_data_dir != local.deploy_path ? 1 : 0) count = (local.tf_data_dir != local.deploy_path ? 1 : 0)
path = local.tf_data_dir path = local.tf_data_dir
@ -75,9 +74,10 @@ resource "file_local" "write_tmp_inputs" {
file_local_directory.deploy_path, file_local_directory.deploy_path,
file_local_directory.tf_data_dir, file_local_directory.tf_data_dir,
] ]
directory = local.tf_data_dir directory = local.tf_data_dir
name = "inputs.tmp" name = "inputs.tmp"
contents = local.inputs contents = local.inputs
permissions = "0400"
} }
resource "file_local_snapshot" "persist_inputs" { resource "file_local_snapshot" "persist_inputs" {
depends_on = [ depends_on = [
@ -107,9 +107,10 @@ resource "file_local" "write_tmp_env" {
file_local_directory.deploy_path, file_local_directory.deploy_path,
file_local_directory.tf_data_dir, file_local_directory.tf_data_dir,
] ]
directory = local.tf_data_dir directory = local.tf_data_dir
name = "env.tmp" name = "env.tmp"
contents = local.export_contents contents = local.export_contents
permissions = "0400"
} }
resource "file_local_snapshot" "persist_envrc" { resource "file_local_snapshot" "persist_envrc" {
depends_on = [ depends_on = [
@ -128,9 +129,10 @@ resource "file_local" "instantiate_envrc_snapshot" {
file_local.write_tmp_env, file_local.write_tmp_env,
file_local_snapshot.persist_envrc, file_local_snapshot.persist_envrc,
] ]
directory = local.deploy_path directory = local.deploy_path
name = "envrc" name = "envrc"
contents = base64decode(file_local_snapshot.persist_envrc.snapshot) contents = base64decode(file_local_snapshot.persist_envrc.snapshot)
permissions = "0644"
} }
## Deploy ## ## Deploy ##