One-click install
npx skills add https://github.com/david-driscoll/stargate-command-cluster --skill opentofu-modules-david-driscoll
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: opentofu-modules
Source: https://github.com/david-driscoll/stargate-command-cluster/tree/main/.agents/skills/opentofu-modules
Command: npx skills add https://github.com/david-driscoll/stargate-command-cluster --skill opentofu-modules-david-driscoll

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It helps you create and maintain homelab OpenTofu modules with consistent structure and reliable test coverage, so configuration changes don’t silently break expected behavior.

Core Features & Use Cases

  • Module scaffolding: Ensures every OpenTofu module includes the required files (variables.tf, main.tf, outputs.tf, versions.tf) plus a tests/ directory.
  • TFTest best practices: Guides you to write .tftest.hcl tests using OpenTofu plan-mode validation and output-based assertions rather than brittle internal checks.
  • Validation & feature regression testing: Shows patterns for testing enabled/disabled feature flags and verifying variable validation failures with expect_failures.
  • Workflow integration: Recommends running module tests via task tg:test-<module> (and formatting via task tg:fmt), with OpenTofu version pinning via .opentofu-version.

Quick Start

Use the opentofu-modules skill to validate and test a new module named app-secrets by writing its required module files and one or more .tftest.hcl test cases using command = plan.

Frequently Asked Questions about opentofu-modules

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write .tftest.hcl tests for OpenTofu modules?

Write .tftest.hcl tests for OpenTofu modules using plan-mode validation and output assertions rather than brittle internal state checks. Place test files under infrastructure/modules/<name>/tests/ and use command = plan to validate variable inputs and module behavior.

What is the required file layout for OpenTofu module scaffolding?

OpenTofu module scaffolding requires a mandatory layout under infrastructure/modules/<name>/ containing variables.tf, main.tf, outputs.tf, versions.tf, plus a dedicated tests/ directory holding the .tftest.hcl files for verifiable behavior.

How do I test variable validation failures and feature flags in Terraform modules?

Test variable validation failures and feature flags in Terraform modules by using expect_failures blocks for rejected inputs and writing distinct .tftest.hcl cases that toggle enabled or disabled feature flags via plan-mode runs.

Can I use this OpenTofu module testing approach for my homelab infrastructure?

Yes, this approach is specifically designed for homelab infrastructure, helping you create and maintain OpenTofu modules with consistent structure and reliable test coverage so configuration changes do not silently break expected behavior.

What is the best way to validate tftest syntax before running module tests?

Validate tftest syntax by running the recommended task tg:test-<module> command, which executes the .tftest.hcl plan-mode runs and output assertions while ensuring formatting compliance via task tg:fmt.

Why are my OpenTofu module tests failing during plan-mode validation?

OpenTofu module tests fail during plan-mode validation when output assertions do not match expected values or variable validation rejects inputs incorrectly. Debug by checking .tftest.hcl syntax, feature flag states, and expect_failures blocks for rejected inputs.