Hi @tung , thanks for such quick reply
Yes, this a use case scenario when TFC isn’t used, in our case the backend is AWS S3 and we can’t feed sensitive values like in TFC Sensitive Environment variables or using AWS SecretsManager or ParametersStore.
Now, here is an example using sops with tg:
db_creds = yamldecode(sops_decrypt_file("${get_terragrunt_dir()}/../../rds/data-creds.sops.yaml"))
datadog_creds = yamldecode(sops_decrypt_file("${get_terragrunt_dir()}/../../rds/datad-creds.sops.yaml"))
once the file has been decryped by sops, then their values can be parsed as locals
master_user = local.db_creds.username
master_password = local.db_creds.password
datadog_user = local.datadog_creds.username
datadog_password = local.datadog_creds.password
Now, sops supports several of major cloud providers and is quite useful for startups too when using gpg encryption.
I do believe a helper can do it, after reading TS documentation, I believe it can be something like:
user = "<%= sops_secret("demo-:ENV-<.key.user>", "<path-to-yaml-encrypted-file>.sops.yaml" %>"
pass = "<%= sops_secret("demo-:ENV-<.key.pass>", "<path-to-yaml-encrypted-file>.sops.yaml") %>"
And translated to a command, it will be:
sops -d <path-to-yaml-encrypted-file>.sops.yaml | yq e '<.key.user>'
sops -d <path-to-yaml-encrypted-file>.sops.yaml | yq e '<.key.pass>'
Sadly I lack the knowledge to get it done in Ruby, but if you have a document to build TS helpers, I can give it a try. It will take me some time but… I’m more than happy to help.
Best, hope it helps.