OpenTofu example module for helpers that provides core platform functionality including workspace parsing, resource labeling, and logos integration for team and project management.
Core Features:
- Workspace Parsing: Extracts environment, region, and zone from structured workspace names
- Resource Labels: Generates consistent labels for resource tagging and organization
- Logos Integration: Connects to logos remote state for team data, project naming, and folder IDs
- Multi-Workspace Support: Aggregates team data across multiple logos workspaces
Note
We do not recommend consuming this module like you might a public module. It is a baseline, something you can fork, potentially maintain, and modify to fit your organization's needs. Using public modules vs. writing your own has various drivers and trade-offs that your organization should evaluate.
module "helpers" {
source = "github.com/osinfra-io/opentofu-core-helpers//root"
cost_center = "x001"
data_classification = "public"
repository = "my-repository"
team = "my-team"
}
# Access workspace parsing outputs
output "environment" {
value = module.helpers.environment
}
output "labels" {
value = module.helpers.labels
}module "helpers" {
source = "github.com/osinfra-io/opentofu-core-helpers//root"
cost_center = "x001"
data_classification = "public"
repository = "my-repository"
team = "my-team"
# Enable logos integration
logos_workspaces = ["my-team-main-production", "logos-main-production"]
}
# Access logos-integrated outputs
output "project_naming" {
value = module.helpers.project_naming
}
output "environment_folder_id" {
value = module.helpers.environment_folder_id
}
output "teams" {
value = module.helpers.teams
}Tip
You can check the tests/fixtures directory for example configurations. These fixtures set up the system for testing by providing all the necessary initial code, thus creating good examples on which to base your configurations.
Our focus is on the core fundamental practice of platform engineering, Infrastructure as Code.
Open Source Infrastructure (as Code) is a development model for infrastructure that focuses on open collaboration and applying relative lessons learned from software development practices that organizations can use internally at scale. - Open Source Infrastructure (as Code)
To avoid slowing down stream-aligned teams, we want to open up the possibility for contributions. The Open Source Infrastructure (as Code) model allows team members external to the platform team to contribute with only a slight increase in cognitive load. This section is for developers who want to contribute to this repository, describing the tools used, the skills, and the knowledge required, along with OpenTofu documentation.
See the documentation for setting up a local development environment.
Links to documentation and other resources required to develop and iterate in this repository successfully.
All tests are mocked allowing us to test the module without creating infrastructure or requiring credentials. The trade-offs are acceptable in favor of speed and simplicity. In an OpenTofu test, a mocked provider or resource will generate fake data for all computed attributes that would normally be provided by the underlying provider APIs.
tofu init
tofu test
To release a new version, simply push a new tag to the repository. The tag should be in the format vX.Y.Z where X, Y, and Z are integers.
git tag vX.Y.Z
git push origin vX.Y.Z