Search code examples
terraformgitignore

gitignore .tfvars but not .auto.tfvars


I'm trying to avoid committing some Terraform vars while committing others. I was hoping something like the following in gitignore would work, but it doesn't.

*.tfvars
!.auto.tfvars

I've tried .tfvars.json but am struggling to get JSON to a TF map object to work properly and think a gitignore exception like !.auto.tfvars to be superior.

Thanks for any suggestions.


Solution

  • NM I need to make it

    *.tfvars
    !*.auto.tfvars
    

    with the * before .auto.tfvars