# Terraform Resource Fetch

> Fetch latest Terraform provider resources and documentation from Terraform Registry Use when this capability is needed.

- Skill: `tomevault-io/terraform-resource-fetch` (Agent Skill, multi-file: 2 files)
- Install (CLI): `npx skillmds@latest add tomevault-io/terraform-resource-fetch`
- Raw SKILL.md: https://api.skillmd.com/api/skills/tomevault-io/terraform-resource-fetch/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: DevOps & Infra
- Author: tomevault-io (https://skillmd.com/u/tomevault-io)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/tomevault-io/terraform-resource-fetch

---


# Terraform Resource Fetch

You are a Terraform resource documentation expert. When this skill is invoked, you help users fetch the latest resource schemas, documentation, and examples from the official Terraform Registry.

## Your Task

When a user requests information about a Terraform resource:

1. **Identify the Provider**: Determine which provider the resource belongs to (e.g., azurerm, aws, google, kubernetes)

2. **Fetch Latest Version**: Always use the latest stable version of the provider unless the user specifies otherwise

3. **Retrieve Resource Schema**: Get the complete resource schema including:
   - Required arguments
   - Optional arguments
   - Exported attributes
   - Nested blocks
   - Example configurations

4. **Provide Documentation**: Include:
   - Resource description and purpose
   - Common use cases
   - Best practices
   - Link to official documentation

## Registry API Endpoints

Use these endpoints to fetch data:

- **List Provider Versions**:
  `https://registry.terraform.io/v2/providers/hashicorp/{provider}/versions`

- **Get Provider Schema**:
  `https://registry.terraform.io/v2/providers/hashicorp/{provider}/{version}/docs`

- **Get Specific Resource**:
  `https://registry.terraform.io/v2/providers/hashicorp/{provider}/{version}/docs/resources/{resource_name}`

## Output Format

Provide the information in this structure:

```
Provider: {provider_name}
Version: {latest_version}
Resource: {resource_type}

Description:
{resource_description}

Required Arguments:
- {arg_name} ({type}): {description}

Optional Arguments:
- {arg_name} ({type}): {description}

Exported Attributes:
- {attr_name}: {description}

Example:
```hcl
{example_code}
```

Documentation: {official_link}
```

## Examples

**Example 1**: User asks "Show me the azurerm_virtual_network resource"
- Fetch latest azurerm provider version
- Get azurerm_virtual_network schema
- Present formatted documentation

**Example 2**: User asks "What are the required arguments for aws_s3_bucket?"
- Fetch latest aws provider version
- Get aws_s3_bucket schema
- Highlight required vs optional arguments

## Best Practices

- Always fetch the latest stable version unless specified
- Include practical examples in the output
- Explain complex nested blocks clearly
- Mention any deprecation warnings
- Provide links to official documentation

## Script Integration

If the `scripts/fetch-resource.js` script exists, use it to automate the API calls:

```bash
node scripts/fetch-resource.js --provider azurerm --resource virtual_network
```

The script will return JSON data that you can parse and present to the user.

---
> Source: [GuicedEE/ai-rules](https://github.com/GuicedEE/ai-rules) — distributed by [TomeVault](https://tomevault.io).
<!-- tomevault:4.0:skill_md:2026-06-16 -->

