Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 9e0ceea

Browse files
committed
Release v0.9.6: Simplify Terraform Registry API Interactions
- Removed `exampleConfigGenerator` tool - Simplified tool interfaces by removing unused parameters - Updated tools to use direct documentation links instead of complex API parsing - Improved error handling and tool resilience - Updated tests to reflect tool changes - Removed fallback patterns in favor of direct documentation links - Updated README.md and api-use.md to reflect tool changes - Clarified required and optional parameters in documentation
1 parent 31dd36e commit 9e0ceea

File tree

11 files changed

+70
-722
lines changed

11 files changed

+70
-722
lines changed

.cursorrules

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- update the version in index.ts and package.json
33
- update the CHANGELOG.md
44
- commit, tag, and push to GitHub
5-
- create a new release on GitHub
5+
- create a new release on GitHub using `gh`
66
- npm and docker releases are handled automatically via GitHub Actions
77
- `npm i -g terraform-mcp-server` to globally install/update the CLI
88

@@ -13,3 +13,4 @@
1313
- run `./test.sh` to run the tests
1414
- run `./test-simple.sh` to run the tests
1515
- locally managed MCP config is in `./.cursor/mcp.json` and `~/Library/Application Support/Claude/claude_desktop_config.json`
16+
- ./api-use.md has examples of how to use the API

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## 0.9.6 (May 21, 2024)
4+
- Removed `exampleConfigGenerator` tool
5+
- Simplified tool interface by removing unused parameters
6+
- Updated tests to reflect tool changes
7+
- Simplified `dataSourceLookup` function to use documentation URL directly
8+
- Simplified `resourceArgumentDetails` function to use documentation URL directly
9+
- Fixed 404 errors in test-simple.sh script
10+
- Made tools more resilient to Terraform Registry API changes
11+
- Removed fallback patterns in favor of simpler, more reliable direct documentation links
12+
- Updated README.md to reflect removal of `exampleConfigGenerator` tool
13+
- Updated api-use.md to document current API usage patterns
14+
- Clarified required and optional parameters in documentation
15+
- Improved documentation formatting and examples
16+
317
## 0.9.5 (April 23, 2024)
418
- Fixed `exampleConfigGenerator` function to handle API changes from HashiCorp Registry
519
- Added fallback approach that uses documentation URLs to generate example configs

README.md

Lines changed: 7 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ Looks up Terraform provider details by name, returning the latest version and ve
7070

7171
```json
7272
{
73-
"provider": "aws", // Optional: Provider name
73+
"provider": "aws", // Required: Provider name
7474
"namespace": "hashicorp", // Optional: Provider namespace (defaults to "hashicorp")
75-
"name": "aws" // Optional: Alternative field for provider name
75+
"version": "latest" // Optional: Provider version
7676
}
7777
```
7878

@@ -97,9 +97,8 @@ Gets example usage of a Terraform resource and related resources.
9797

9898
```json
9999
{
100-
"provider": "aws", // Optional: Provider name
101-
"resource": "aws_instance", // Optional: Resource name
102-
"name": "aws_instance" // Optional: Alternative field for resource name
100+
"provider": "aws", // Required: Provider name
101+
"resource": "aws_instance" // Required: Resource name
103102
}
104103
```
105104

@@ -124,8 +123,7 @@ Searches for and recommends Terraform modules based on a query.
124123

125124
```json
126125
{
127-
"query": "vpc", // Optional: Search query
128-
"keyword": "vpc", // Optional: Alternative field for search query
126+
"query": "vpc", // Required: Search query
129127
"provider": "aws" // Optional: Filter modules by provider
130128
}
131129
```
@@ -169,37 +167,7 @@ Retrieves available data source identifiers for a given Terraform provider.
169167
}
170168
```
171169

172-
### 5. Provider Schema Details
173-
174-
Retrieves full schema details of a provider, including resource and data source schemas.
175-
176-
**Input:**
177-
178-
```json
179-
{
180-
"provider": "aws", // Required: Provider name
181-
"namespace": "hashicorp" // Required: Provider namespace
182-
}
183-
```
184-
185-
**Output:**
186-
187-
```json
188-
{
189-
"content": [{
190-
"type": "text",
191-
"text": {
192-
"provider_schema": {
193-
"provider_schemas": { ... },
194-
"resource_schemas": { ... },
195-
"data_source_schemas": { ... }
196-
}
197-
}
198-
}]
199-
}
200-
```
201-
202-
### 6. Resource Argument Details
170+
### 5. Resource Argument Details
203171

204172
Fetches comprehensive details about a specific resource type's arguments, including required and optional attributes, nested blocks, and their descriptions.
205173

@@ -240,7 +208,7 @@ BLOCKS:
240208
For full documentation, visit: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance
241209
```
242210

243-
### 7. Module Details
211+
### 6. Module Details
244212

245213
Retrieves detailed metadata for a Terraform module.
246214

@@ -283,35 +251,6 @@ Retrieves detailed metadata for a Terraform module.
283251
}
284252
```
285253

286-
### 8. Example Configuration Generator
287-
288-
Generates a minimal Terraform configuration for a given provider and resource.
289-
290-
**Input:**
291-
292-
```json
293-
{
294-
"provider": "aws", // Required: Provider name
295-
"namespace": "hashicorp", // Required: Provider namespace
296-
"resource": "aws_instance" // Required: Resource name
297-
}
298-
```
299-
300-
**Output:**
301-
302-
```json
303-
{
304-
"content": [
305-
{
306-
"type": "text",
307-
"text": {
308-
"example_configuration": "resource \"aws_instance\" \"example\" {\n ami = \"example\"\n instance_type = \"example\"\n}\n"
309-
}
310-
}
311-
]
312-
}
313-
```
314-
315254
## Running the Server
316255

317256
The server runs using stdio transport for MCP communication:

api-use.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ This document outlines our understanding and use of the Terraform Registry API f
1717
### Resource Endpoints
1818

1919
- **Resource Details**: `https://registry.terraform.io/v1/providers/{namespace}/{provider}/resources/{resource}`
20-
- Used in `resourceArgumentDetails` and `exampleConfigGenerator` tools
20+
- Used in `resourceArgumentDetails`
2121
- This endpoint has been reported as returning 404 errors
2222
- We now use a fallback approach when this fails
2323

2424
- **Resource Documentation**: `https://registry.terraform.io/providers/{namespace}/{provider}/latest/docs/resources/{resource}`
25-
- Used as a fallback in `exampleConfigGenerator` when the API endpoint fails
2625
- HTML documentation page that can be parsed for examples
26+
- Used for retrieving resource details when API endpoints fail
2727

2828
### Module Endpoints
2929

@@ -37,17 +37,13 @@ This document outlines our understanding and use of the Terraform Registry API f
3737

3838
## API Changes and Issues
3939

40-
As of version 0.9.5, we've encountered some issues with the Terraform Registry API:
40+
As of version 0.9.6, we've encountered some issues with the Terraform Registry API:
4141

4242
1. **Resource Details Endpoint Failures**:
4343
- The `/v1/providers/{namespace}/{provider}/resources/{resource}` endpoint often returns 404 errors
4444
- We've implemented fallbacks using documentation URLs to handle these failures
4545

46-
2. **Example Configuration Generation**:
47-
- Direct API methods for retrieving example configurations are unreliable
48-
- We've implemented a fallback approach that parses documentation pages for examples
49-
50-
3. **Provider Schema Access**:
46+
2. **Provider Schema Access**:
5147
- When API endpoints fail, we attempt to download the provider schema directly
5248
- This provides a complete schema but requires additional processing
5349

@@ -56,7 +52,7 @@ As of version 0.9.5, we've encountered some issues with the Terraform Registry A
5652
When API endpoints fail, we employ these fallback strategies:
5753

5854
1. **Documentation URL Parsing**:
59-
- For example configurations, we fall back to scraping the documentation
55+
- For resource details, we fall back to using the documentation URL directly
6056
- URLs follow the pattern: `https://registry.terraform.io/providers/{namespace}/{provider}/latest/docs/resources/{resource}`
6157

6258
2. **Provider Schema Download**:

generate-example.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)