Skip to content

Instantly share code, notes, and snippets.

View chagui's full-sized avatar
🕵️
Observe all the things

Guilhem C. chagui

🕵️
Observe all the things
View GitHub Profile
@chagui
chagui / force-unlock-all.sh
Created June 12, 2023 14:17
For all direct sub-directory find if there is a the lock on the terraform state and remove it
#!/usr/bin/env bash
function unlock_module {
pushd "$1"
local -r lock_id="$(terraform refresh 2>&1 | rg ID | awk -F ' ' '{print $4}')"
if [[ -n $lock_id ]]; then
echo "lock: $lock_id"
terraform force-unlock -force "$lock_id"
else