Skip to content

masterpointio/terraform-secrets-helper

Repository files navigation

Banner

terraform-secrets-helper

Release

💡 Learn more about Masterpoint below.

Purpose and Functionality

This Terraform module provides a standard and extensible way of managing secrets from different sources, making them accessible through local.secrets["<SECRET_NAME>"]. It's designed to create an abstract interface for dealing with secrets in Terraform, regardless of the source of these secrets.

Our initial version is built to handle SOPS secrets, but it is designed in a way that it can be easily extended to support other secret providers like AWS SSM Parameter Store, Vault, and more in the future.

This module can be included as a child module, where needed, to fetch secrets and provide them in an abstract manner.

Usage

Copy exports/secrets.sops.tf to your project by running the following command:

curl -sL https://raw.githubusercontent.com/masterpointio/terraform-secrets-helper/main/exports/secrets.sops.tf -o secrets.sops.tf

The mixin incorporates the invocation of this module, so you simply need to configure the required secret_mapping variable and then reference it within your code.

See the full example in examples/complete

secret_mapping = [{
  name = "db_password"
  file = "test.yaml"
  type = "sops"
}]

output "db_password" {
  value     = jsonencode(local.secrets["db_password"])
  sensitive = true
}

Future Enhancements

While the current version is specific to SOPS, future mixins will support other secret providers like SSM Parameter Store, Vault, and more. The future mixins will include all necessary provider configuration for themselves, making the process of integrating with different secret providers seamless.

Requirements

Name Version
terraform >= 1.3
sops >= 0.7

Providers

Name Version
sops >= 0.7

Modules

No modules.

Resources

Name Type
sops_file.sops_secrets data source

Inputs

Name Description Type Default Required
secret_mapping The list of secret mappings the application will need.
This creates secret values for the component to consume at local.secrets[name].
list(object({
name = string
type = optional(string, "sops")
path = optional(string, null)
file = string
}))
[] no

Outputs

Name Description
all The final secrets pulled from various sources.

Built By

Powered by the Masterpoint team and driven forward by contributions from the community ❤️

Contributors

Contribution Guidelines

Contributions are welcome and appreciated!

Found an issue or want to request a feature? Open an issue

Want to fix a bug you found or add some functionality? Fork, clone, commit, push, and PR — we'll check it out.

Who We Are 𐦂𖨆𐀪𖠋

Established in 2016, Masterpoint is a team of experienced software and platform engineers specializing in Infrastructure as Code (IaC). We provide expert guidance to organizations of all sizes, helping them leverage the latest IaC practices to accelerate their engineering teams.

Our Mission

Our mission is to simplify cloud infrastructure so developers can innovate faster, safer, and with greater confidence. By open-sourcing tools and modules that we use internally, we aim to contribute back to the community, promoting consistency, quality, and security.

Our Commitments

  • 🌟 Open Source: We live and breathe open source, contributing to and maintaining hundreds of projects across multiple organizations.
  • 🌎 1% for the Planet: Demonstrating our commitment to environmental sustainability, we are proud members of 1% for the Planet, pledging to donate 1% of our annual sales to environmental nonprofits.
  • 🇺🇦 1% Towards Ukraine: With team members and friends affected by the ongoing Russo-Ukrainian war, we donate 1% of our annual revenue to invasion relief efforts, supporting organizations providing aid to those in need. Here's how you can help Ukraine with just a few clicks.

Connect With Us

We're active members of the community and are always publishing content, giving talks, and sharing our hard earned expertise. Here are a few ways you can see what we're up to:

LinkedIn Newsletter Blog YouTube

... and be sure to connect with our founder, Matt Gowie.

License

Apache License, Version 2.0.

Open Source Initiative

Copyright © 2016-2025 Masterpoint Consulting LLC

About

The Terraform module that abstracts the way we manage secrets.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •