
hashicorp/agent-skills
16 skills52k installs12.5k starsGitHub
Install
npx skills add https://github.com/hashicorp/agent-skillsSkills in this repo
1Terraform Style GuideGenerate Terraform HCL code following HashiCorp's official style conventions and best practices Use when writing reviewing or generating Terraform configurations name terraform-style-guide description Generate Terraform HCL code following HashiCorp's official style conventions and best practices Use when writing reviewing or generating Terraform configurations Terraform Style Guide Generate and maintain Terraform code following HashiCorp's official style conventions and best practices Reference HashiCorp Terraform Style Guide https developer hashicorp com terraform language style Code Generation Strategy When generating Terraform code 1 Start with provider configuration and version constraints 2 Create data sources before dependent resources 3 Build resources in dependency order 4 Add outputs for key resource attributes 5 Use variables for all configurable values File Organization File Purpose terraform tf Terraform and provider version requirements providers tf Provider configurations main tf Primary resources and data sources variables tf Input variable declarations alphabetical outputs tf Output value declarations alphabetical locals tf Local value declarations Example Structur.8.6kinstalls2Terraform TestTerraform Test provides a built-in framework for validating infrastructure-as-code configurations through plan-mode unit tests and apply-mode integration tests. Developers use it to catch breaking changes before deployment, test module outputs and resource behavior, mock external dependencies, and validate conditional logic. Core workflows include writing .tftest.hcl files with run blocks (test scenarios), defining assert blocks for validation, using mock providers to avoid credentials, and organizing tests by type (unit vs integration) for efficient CI/CD execution. Tests run against temporary resources and clean up automatically, protecting existing state. --- name: terraform-test description: Comprehensive guide for writing and running Terraform tests. Use when creating test files (.tftest.hcl), writing test scenarios with run blocks, validating infrastructure behavior with assertions, mocking providers and data sources, testing module outputs and resource configurations, or troubleshooting Terraform test syntax and execution. metadata: copyright: Copyright IBM Corp.6.1kinstalls3Refactor ModuleThe refactor-module skill Transform monolithic Terraform configurations into reusable, maintainable modules following HashiCorp's module design principles and community best practices. Overview This skill guides AI agents in transforming monolithic Terraform configurations into reusable, maintainable modules following HashiCorp's module design principles and community best practices. Capability Statement The agent will analyze existing Terraform code and systematically refactor it into well-structured modules with: - Clear interface contracts (variables and outputs) - Proper encapsulation and abstraction - Versioning and documentation - Testing frameworks - Migration path for existing state Prerequisites - Existing Terraform configuration to refactor - Understanding of resource dependencies - Access to current state file (for migration planning) - Knowledge of module registry patterns Parameter Type Required Description ----------- ------ ---------- ------------- source_directory string Yes Path to existing Terraform co Parameter Type Required Description ----------- ------ ---------- ------------- source_directory string Yes Path to existing Terraform configuration module_name st.4.4kinstalls4Terraform StacksThe terraform-stacks skill Comprehensive guide for working with HashiCorp Terraform Stacks Use when creating modifying or validating Terraform Stack configurations tfcomponent hcl tfdeploy hcl files working with stack components and deployments from local modules public registry or private registry sources managing multi-region or multi-environment infrastructure or troubleshooting Terraform Stacks syntax and structure Terraform Stacks Terraform Stacks simplify infrastructure provisioning and management at scale by providing a configuration layer above traditional Terraform modules Stacks enable declarative orchestration of multiple components across environments regions and cloud accounts Core Concepts Stack A complete unit of infrastructure composed of components and deployments that can be managed together Component An abstraction around a Terraform module that defines infrastructure pieces Each component specifies a source module inputs and providers Deployment An instance of all components in a stack with specific input values Use deployments for different environments dev staging prod regions or cloud accounts Stack Language A separate HCL-based language not regular Terrafor.4.3kinstalls5Terraform Search ImportTerraform Search and Bulk Import is a HashiCorp agent skill for bringing unmanaged cloud infrastructure under Terraform control using declarative list queries and identity-based bulk import. Before any workflow starts, you must verify the target provider supports list resources via list_resources.sh or terraform providers schema, and confirm Terraform is at least version 1.14. Supported resources follow a five-step path: write .tfquery.hcl files with list blocks, run terraform query, generate configuration with -generate-config-out, review generated resource and import blocks, then plan and apply. Query files support provider blocks, filtered discovery by tags or instance types, multi-region for_each patterns, and parameterized variables. Generated output includes full resource attributes plus import blocks using identity fields for Terraform 1.12 and newer. Post-generation cleanup removes computed attributes, replaces hardcoded values with variables, and organizes files. When list resources are unsupported or Terraform is below 1.14, the skill routes to the manual discovery workflow in MANUAL-IMPORT.md. Best practices emphasize starting broad, using limit, testing queries before.3.4kinstalls6Provider ResourcesProvider Resources is a HashiCorp agent skill for building Terraform provider resources and data sources with the Plugin Framework and SDKv2 patterns. It documents file layout under internal/service, website docs paths, Metadata and Schema methods, and Create, Read, Update, Delete handlers with diagnostics. Schema guidance covers attribute types, plan modifiers like RequiresReplace and UseStateForUnknown, validators for strings and lists, and sensitive fields. State management explains NotFound handling that removes resources from state, wait helpers for CREATED to ACTIVE transitions, and finder functions returning retry.NotFoundError. Testing sections include basic acceptance tests, disappears tests, import verification, helper existence checks, and TF_ACC go test commands with sweepers. Error handling maps API exceptions such as ResourceNotFound, Conflict, and Throttling to Terraform diagnostics. The pre-submission checklist requires compile success, CRUD completeness, import, disappears tests, and documentation with HCL examples.2.9kinstalls7Provider Actionsprovider-actions guides implementing Terraform Provider actions with the Plugin Framework for imperative operations at before and after create, update, and destroy lifecycle events. Actions live under internal/service with action_name_action.go, tests, and generated service registration plus website docs and changelog entries. Schema definitions use framework attributes with Required, Optional, Computed, ElementType on lists, and fwtypes instead of plugin types. Invoke methods read config, create provider clients, send progress updates, manage timeouts with context.WithTimeout, and map API errors to diagnostics. Requirements cover progress reporting, configurable timeouts defaulting to 1800 seconds, pagination, retry logic, parameter validation, and polling for async operations. A schema validation checklist catches type mismatches, missing ElementType, and incorrect Computed flags before go build. Documentation lands in website/docs/actions and .changelog release note entries accompany each action with IBM copyright metadata on the skill.2.8kinstalls8New Terraform Providernew-terraform-provider scaffolds a fresh Terraform provider using the Plugin Framework. If already inside a provider workspace, confirm intent before creating a new root. Create a directory prefixed terraform-provider-, initialize a Go module, and run go get for terraform-plugin-framework latest. Write main.go following the bundled example asset in assets/main.go, remove TODO comments, then run go mod tidy, go build -o /dev/null, and go test ./... to verify compilation and tests pass. All subsequent steps occur inside the new workspace root. The skill is a concise procedural checklist focused on bootstrapping a compilable provider skeleton that agents extend with services, resources, and data sources in follow-on work. It is licensed MPL-2.0 with IBM copyright metadata and targets greenfield provider workspaces rather than extending existing mature providers without explicit user confirmation to skip steps.2.7kinstalls9Run Acceptance TestsThe run-acceptance-tests skill guides running Terraform provider acceptance tests, which are Go functions prefixed TestAcc. To run a focused test such as TestAccFeatureHappyPath, execute go test -run=TestAccFeatureHappyPath with environment variable TF_ACC=1 set, defaulting to non-verbose output. Additional provider-specific environment variables may be required; when test output indicates missing variables, suggest secure setup steps rather than embedding secrets. Diagnosis escalates cumulatively: rerun with -count=1 to bypass cached results, add -v for verbose output, set TF_LOG=debug for debug logging, and TF_ACC_WORKING_DIR_PERSIST=1 to keep the Terraform workspace for inspection. A passing test may be a false negative; flip testing validates TestCheckFuncs by editing an expected value in a TestStep, expecting failure, then undoing on success. The skill targets HashiCorp Terraform provider maintainers validating infrastructure resources against real APIs during development and CI, emphasizing secure credential guidance when providers demand cloud or service tokens.2.6kinstalls10Azure Verified ModulesAzure Verified Modules AVM Requirements This guide covers the mandatory requirements for Azure Verified Modules certification These requirements ensure consistency quality and maintainability across Azure Terraform modules References Azure Verified Modules https azure github io Azure Verified Modules AVM Terraform Requirements https azure github io Azure Verified Modules specs terraform Module Cross Referencing module cross referencing Azure Provider Requirements azure provider requirements Code Style Standards code style standards Variable Requirements variable requirements Output Requirements output requirements Local Values Standards local values standards Terraform Configuration Requirements terraform configuration requirements Testing Requirements testing requirements Documentation Requirements documentation requirements Breaking Changes Feature Management breaking changes feature management Contribution Standards contribution standards Compliance Checklist compliance checklist Severity MUST Requirement TFFR1 The azure verified modules agent skill provides documented workflows prerequisites triggers and safety guidance from its SKILL md source Agents load it when user request.2.3kinstalls11Aws Ami BuilderThe aws-ami-builder skill builds EC2 AMIs using Packer amazon-ebs builder with HCL templates, plugin requirements, and source_ami_filter patterns for Ubuntu 22.04 and Amazon Linux 2023. Basic template sets region, t3.micro instance type, Canonical owner filters, ssh_username, timestamped ami_name, and shell provisioner inline apt upgrade steps. Multi-region ami_regions copy supports us-east-1, us-east-2, and eu-west-1 distribution. Authentication follows AWS credential chain from environment variables, credentials file, or EC2 instance profile. Build commands cover packer init, validate, and build with optional var overrides. Common issues document SSH timeout security group fixes, unique AMI name requirements with timestamp suffixes, and volume size constraints via launch_block_device_mappings. Note that AMI builds incur EC2 and EBS costs for ten to thirty minute runs. Use when creating custom AMIs for EC2 with Packer amazon-ebs builder templates. The workflow follows the source SKILL.md contract with progressive reference loading, clear trigger phrases, and practical steps developers can apply directly in agent sessions.2.2kinstalls12Provider Test PatternsThe provider-test-patterns skill. Terraform provider acceptance test patterns using terraform-plugin-testing with the Plugin Framework. Covers test structure, TestCase/TestStep fields, ConfigStateChecks with custom statecheck.StateCheck implementations, plan checks, CompareValue for cross-step assertions, config helpers, import testing with ImportStateKind, sweepers, and scenario patterns (basic, update, disappears, validation, re. If the final plan shows a diff, the test fails (unless is set). After all steps, destroy runs followed by . This means every test automatically verifies that configurations apply cleanly and produce no drift - no assertions needed for that. --- ## Test Function Structure Use by default. Use only when tests share state or cannot run concurrently. Compose built-in checks with custom implementations. The workflow follows the source SKILL.md contract with progressive reference loading, clear trigger phrases, and practical steps developers can apply directly in agent sessions.2.2kinstalls13Provider DocsThe provider-docs skill Create, update, and review Terraform provider documentation for Terraform Registry using HashiCorp-recommended patterns, tfplugindocs templates, and schema descriptions. Use when adding or changing provider configuration, resources, data sources, ephemeral resources, list resources, functions, or guides; when validating generated docs; and when troubleshooting missing or incorrect Registry documentation. It covers confirm scope and documentation targets.. Key workflows include map code changes to the exact doc targets: provider index, resources, data sources, ephemeral resources, list resources, functions, or guides.. Developers invoke provider-docs when the task matches the triggers and reference files in SKILL.md for grounded, stepwise execution. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation.2kinstalls14Push To RegistryThe push-to-registry skill Push Packer build metadata to HCP Packer registry for tracking and managing image lifecycle. Use when integrating Packer builds with HCP Packer for version control and governance. It covers navigate to HCP → Access Control IAM. Key workflows include create Service Principal. Developers invoke push-to-registry when the task matches the triggers and reference files in SKILL.md for grounded, stepwise execution. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation. Reference files and progressive disclosure keep context focused while preserving concrete commands, configuration fields, and validation checks copied from the upstream documentation.2kinstalls15Azure Image BuilderThe azure-image-builder skill builds Azure managed images and Azure Compute Gallery images using Packer azure-arm builder per HashiCorp docs. Notes costs compute storage transfer and typical 15-45 minute builds. Basic managed image HCL uses required_plugins azure block sensitive client_id client_secret variables and arm builder configuration patterns. Use scaffolding Packer templates for Azure image pipelines gallery publishing and infrastructure image automation with HashiCorp Packer azure integration. Packer azure-arm builder for Azure images. Managed image and Compute Gallery targets. Builds typically 15-45 minutes with cost note. required_plugins azure version pin. Sensitive service principal variables. Azure image builder Packer skill. User asks Packer Azure image builder.1.8kinstalls16Windows BuilderThe windows builder skill Build Windows images with Packer using WinRM communicator and PowerShell provisioners. Use when creating Windows AMIs, Azure images, or VMware templates. Documentation covers workflows, commands, and guardrails agents should follow when users invoke this capability. Key documented areas include Increase `winrm_timeout` to 15m or more; Verify security group allows ports 5985/5986; Check user data script completed successfully; Windows Updates can take 1-2 hours. Reference commands include source "amazon-ebs" "windows" {; region = "us-west-2". Use when developers or agents need structured guidance for windows builder tasks with evidence grounded in the bundled SKILL.md rather than generic advice. Increase `winrm_timeout` to 15m or more Verify security group allows ports 5985/5986 Check user data script completed successfully Windows Updates can take 1-2 hours Use pre-patched base images when available Set provisioner `timeout = "2h"` [Packer Windows Builders](https://developer.hashicorp.com/packer/guides/windows) [WinRM Communicator](https://developer.hashicorp.com/packer/docs/communicators/winrm) Build Windows images with Packer using WinRM communic.1.8kinstalls