Skip to content

Commit abd80e7

Browse files
committed
fix: increase permissions and return to directory
Signed-off-by: matttrach <matt.trachier@suse.com>
1 parent 3c161fb commit abd80e7

3 files changed

Lines changed: 21 additions & 13 deletions

File tree

modules/deploy/create.sh.tpl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
set -x
2+
DIR=$(pwd)
23
cd ${deploy_path}
34
pwd
45
ls -lah
5-
. envrc
6+
whoami
7+
. ${deploy_path}/envrc
68
TF_CLI_ARGS_init=""
79
TF_CLI_ARGS_apply=""
810

@@ -54,5 +56,5 @@ if [ $EXITCODE -eq 0 ]; then
5456
echo "success...";
5557
terraform output -json -state="${deploy_path}/tfstate" > ${deploy_path}/outputs.json
5658
fi
57-
59+
cd $DIR
5860
exit $EXITCODE

modules/deploy/destroy.sh.tpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
set -x
2+
DIR=$(pwd)
23
cd ${deploy_path}
34
pwd
45
ls -lah
5-
. envrc
6+
whoami
7+
. ${deploy_path}/envrc
68
TF_CLI_ARGS_init=""
79
TF_CLI_ARGS_apply=""
810
if [ -z "${skip_destroy}" ]; then
@@ -11,3 +13,5 @@ if [ -z "${skip_destroy}" ]; then
1113
else
1214
echo "Not destroying deployed module, it will no longer be managed here."
1315
fi
16+
cd $DIR
17+
exit 0

modules/deploy/main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ resource "file_local_directory" "deploy_path" {
3131
path = local.deploy_path
3232
permissions = "0755"
3333
}
34-
3534
resource "file_local_directory" "tf_data_dir" {
3635
count = (local.tf_data_dir != local.deploy_path ? 1 : 0)
3736
path = local.tf_data_dir
@@ -75,9 +74,10 @@ resource "file_local" "write_tmp_inputs" {
7574
file_local_directory.deploy_path,
7675
file_local_directory.tf_data_dir,
7776
]
78-
directory = local.tf_data_dir
79-
name = "inputs.tmp"
80-
contents = local.inputs
77+
directory = local.tf_data_dir
78+
name = "inputs.tmp"
79+
contents = local.inputs
80+
permissions = "0400"
8181
}
8282
resource "file_local_snapshot" "persist_inputs" {
8383
depends_on = [
@@ -107,9 +107,10 @@ resource "file_local" "write_tmp_env" {
107107
file_local_directory.deploy_path,
108108
file_local_directory.tf_data_dir,
109109
]
110-
directory = local.tf_data_dir
111-
name = "env.tmp"
112-
contents = local.export_contents
110+
directory = local.tf_data_dir
111+
name = "env.tmp"
112+
contents = local.export_contents
113+
permissions = "0400"
113114
}
114115
resource "file_local_snapshot" "persist_envrc" {
115116
depends_on = [
@@ -128,9 +129,10 @@ resource "file_local" "instantiate_envrc_snapshot" {
128129
file_local.write_tmp_env,
129130
file_local_snapshot.persist_envrc,
130131
]
131-
directory = local.deploy_path
132-
name = "envrc"
133-
contents = base64decode(file_local_snapshot.persist_envrc.snapshot)
132+
directory = local.deploy_path
133+
name = "envrc"
134+
contents = base64decode(file_local_snapshot.persist_envrc.snapshot)
135+
permissions = "0644"
134136
}
135137

136138
## Deploy ##

0 commit comments

Comments
 (0)