From 60c21dc5a166f4ed8d0717ca6e417d76f79f30c0 Mon Sep 17 00:00:00 2001 From: Felix Uhl Date: Thu, 15 Dec 2022 16:59:55 +0100 Subject: [PATCH] Add terraform_init_upgrade When working on different branches, terraform provider versions may differ. Often you forget to run terraform init -upgrade before your regular terraform commands. This rule lets you fix that. --- thefuck/rules/terraform_init_upgrade.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 thefuck/rules/terraform_init_upgrade.py diff --git a/thefuck/rules/terraform_init_upgrade.py b/thefuck/rules/terraform_init_upgrade.py new file mode 100644 index 0000000..724a84d --- /dev/null +++ b/thefuck/rules/terraform_init_upgrade.py @@ -0,0 +1,10 @@ +from thefuck.shells import shell +from thefuck.utils import for_app + + +@for_app('terraform') +def match(command): + return 'Inconsistent dependency lock file' in command.output + +def get_new_command(command): + return shell.and_('terraform init -upgrade', command.script)