diff --git a/terraform-mode.el b/terraform-mode.el
index 15e33bd..ac62dea 100644
--- a/terraform-mode.el
+++ b/terraform-mode.el
@@ -404,7 +404,7 @@ If the point is not at the heading, call
   (imenu-add-to-menubar "Terraform"))
 
 ;;;###autoload
-(add-to-list 'auto-mode-alist '(".\\(tf\\(vars\\)?\\|tofu\\)'". terraform-mode))
+(add-to-list 'auto-mode-alist '("\\.t\\(f\\(vars\\)?\\|ofu\\)\\'" . terraform-mode))
 
 (provide 'terraform-mode)