Skip to content

Commit ba40cab

Browse files
committed
Encrypt files with Ansible Vault and ensure ownership
1 parent 60a0c89 commit ba40cab

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/actions/init.sh

+5
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ action_init() {
104104
echo "${BOLD}${BLUE}⚡️ Running Ansible Vault to encrypt Spin configurations...${RESET}"
105105
echo "${BOLD}${YELLOW}⚠️ NOTE: This password will be required anytime someone needs to change these files.${RESET}"
106106
echo "${BOLD}${YELLOW}We recommend using a RANDOM PASSWORD.${RESET}"
107+
108+
# Encrpyt with Ansible Vault
107109
run_ansible ansible-vault encrypt "${files_to_encrypt[@]}"
110+
111+
# Ensure the files are owned by the current user
112+
docker run --rm -v "$(pwd):/ansible" $SPIN_ANSIBLE_IMAGE chown -R "${SPIN_USER_ID}:${SPIN_GROUP_ID}" /ansible
108113
echo "${BOLD}${YELLOW}👉 NOTE: You can save this password in \".vault-password\" in the root of your project if you want your secret to be remembered.${RESET}"
109114
elif [[ $encrypt_response =~ ^[Nn]$ ]]; then
110115
echo "${BOLD}${BLUE}👋 Ok, we won't encrypt these files.${RESET} You can always encrypt it later by running \"spin vault encrypt\"."

0 commit comments

Comments
 (0)