Skip to content

Instantly share code, notes, and snippets.

@mjaromi
Last active February 9, 2021 17:01
Show Gist options
  • Save mjaromi/39e3ac3ca4bccb8ce0012baeac326b91 to your computer and use it in GitHub Desktop.
Save mjaromi/39e3ac3ca4bccb8ce0012baeac326b91 to your computer and use it in GitHub Desktop.
Show diff between current and new task_definition
terragrunt plan | egrep '(new resource required)|container_definitions' | sed -n '$!N;s/\x1b\[[0-9;]*m//g;s/\n/;/;s/.*aws_ecs_task_definition.//g;s/ *(new resource required)//g;s/ *container_definitions: *"//gp;;s/" *(forces new resource)//g' | while read task_definition; do
echo -e "\nDIFF for: \033[0;31m$(echo $task_definition | cut -d';' -f1)\033[0m\n$(diff <(echo $task_definition | cut -d';' -f2- | sed 's/\\"/"/g;s/^ //g;s/ => /\n/g;s/"\[/\[/g;s/\]"/\]/g;s/ *(forces new resource)//g' | head -1 | jq) <(echo $task_definition | cut -d';' -f2- | sed 's/\\"/"/g;s/^ //g;s/ => /\n/g;s/"\[/\[/g;s/\]"/\]/g;s/ *(forces new resource)//g' | tail -1 | jq))" | egrep -v '\+\+\+|\-\-\-' | egrep '^(\+|\-|DIFF for)'
done
@sobi3ch
Copy link

sobi3ch commented Sep 24, 2020

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment