Skip to content

Instantly share code, notes, and snippets.

@whazor
Created December 12, 2022 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whazor/d53fb758623959fa66d016d0e44b706e to your computer and use it in GitHub Desktop.
Save whazor/d53fb758623959fa66d016d0e44b706e to your computer and use it in GitHub Desktop.
terraform sops
# .tfstate files
*.tfstate
*.tfstate.*
# do not ignore encrypted tfstate files, with .enc inside
!*.enc.tfstate
!*.enc.tfstate.*
# unless it is decrypted
*.decrypted*tfstate
*.decrypted*tfstate.*
---
creation_rules:
# I want to add regex such to keep some properties, but entire file is works for now
- path_regex: (\.enc)?\.tfstate(\.backup)?$
age: "age........."
#!/bin/bash
sops --decrypt terraform.enc.tfstate > terraform.tfstate
terraform $@
sops --encrypt terraform.tfstate > terraform.enc.tfstate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment