Skip to content

Using Mozilla SOPS and Terraform to create secrets in AWS Secrets Manager

Notifications You must be signed in to change notification settings

jvelasquez/sops-terraform-aws-secretsmanager

Repository files navigation

sops-terraform-aws-secretsmanager

Execute the following commands:

# Change with appropriate value(s)
SECRET_KMS=arn:aws:kms:eu-west-1:******:alias/sops-key

# Encode secrets
sops --encrypt --kms ${SECRET_KMS} secrets.dec.yaml > secrets.enc.yaml

# Generate Terraform code for secrets
gomplate --datasource secrets=secrets.dec.yaml --file secrets.tf.tpl --out secrets.tf

# Generate Terraform variables file for secrets
gomplate --datasource secrets=secrets.dec.yaml --file secrets.tfvars.tpl --out secrets.dec.tfvars

# Plan terraform using the var file generated
terraform plan -var-file=secrets.dec.tfvars

Never commit the secrets.dec.* files! They are included here only for demonstration purposes.

About

Using Mozilla SOPS and Terraform to create secrets in AWS Secrets Manager

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published