file_pathstring
The encrypted file. A relative path resolves from the unit’s directory, even in an included file.
sops_decrypt_file(file_path: string) --> stringsops_decrypt_file decrypts a file encrypted with SOPS, so a repository can hold secrets encrypted with AWS KMS, GCP KMS, Azure Key Vault, HashiCorp Vault, age, or PGP. It reads the file as YAML, JSON, INI, or dotenv by its extension, and any other file as text. Decode the result to use it:
locals { secrets_file = find_in_parent_folders("secrets.yaml") secrets = yamldecode(sops_decrypt_file(local.secrets_file))}
inputs = merge(local.secrets, { instance_type = "t3.micro"})It fails when the file doesn’t exist, can’t be decrypted, or decrypts to content that isn’t valid UTF-8. To fall back to a default, wrap the call in try:
locals { secrets = try(jsondecode(sops_decrypt_file("secrets.json")), {})}Terragrunt decrypts each file once per command, and units that read the same file share the result.
The encrypted file. A relative path resolves from the unit’s directory, even in an included file.
locals { secrets = yamldecode(sops_decrypt_file("secrets.yaml"))}