terraform_documentation

package
v0.40.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client handles communication with the Terraform Registry API

func NewClient

func NewClient(logger *logrus.Logger) *Client

NewClient creates a new Terraform Registry API client with proxy support

func (*Client) GetLatestModuleVersion

func (c *Client) GetLatestModuleVersion(ctx context.Context, moduleID string) (*mcp.CallToolResult, error)

GetLatestModuleVersion gets the latest version of a module

func (*Client) GetLatestProviderVersion

func (c *Client) GetLatestProviderVersion(ctx context.Context, providerNamespace, providerName string) (*mcp.CallToolResult, error)

GetLatestProviderVersion gets the latest version of a provider

func (*Client) GetModuleDetails

func (c *Client) GetModuleDetails(ctx context.Context, moduleID string) (*mcp.CallToolResult, error)

GetModuleDetails gets detailed information about a module

func (*Client) GetPolicyDetails

func (c *Client) GetPolicyDetails(ctx context.Context, policyID string) (*mcp.CallToolResult, error)

GetPolicyDetails gets detailed information about a policy

func (*Client) GetProviderDetails

func (c *Client) GetProviderDetails(ctx context.Context, providerDocID string) (*mcp.CallToolResult, error)

GetProviderDetails gets detailed provider documentation

func (*Client) SearchModules

func (c *Client) SearchModules(ctx context.Context, moduleQuery string, currentOffset int) (*mcp.CallToolResult, error)

SearchModules searches for Terraform modules

func (*Client) SearchPolicies

func (c *Client) SearchPolicies(ctx context.Context, policyQuery string) (*mcp.CallToolResult, error)

SearchPolicies searches for Terraform policies

func (*Client) SearchProviders

func (c *Client) SearchProviders(ctx context.Context, providerName, providerNamespace, serviceSlug, providerDataType, providerVersion string) (*mcp.CallToolResult, error)

SearchProviders searches for provider documentation

type Module

type Module struct {
	ID          string    `json:"id"`
	Owner       string    `json:"owner"`
	Namespace   string    `json:"namespace"`
	Name        string    `json:"name"`
	Version     string    `json:"version"`
	Provider    string    `json:"provider"`
	Description string    `json:"description"`
	Source      string    `json:"source"`
	Tag         string    `json:"tag"`
	PublishedAt time.Time `json:"published_at"`
	Downloads   int       `json:"downloads"`
	Verified    bool      `json:"verified"`
}

Module represents a Terraform module

type ModuleDependency

type ModuleDependency struct {
	Name    string `json:"name"`
	Source  string `json:"source"`
	Version string `json:"version"`
}

ModuleDependency represents a module dependency

type ModuleDetails

type ModuleDetails struct {
	ID           string             `json:"id"`
	Owner        string             `json:"owner"`
	Namespace    string             `json:"namespace"`
	Name         string             `json:"name"`
	Version      string             `json:"version"`
	Provider     string             `json:"provider"`
	Description  string             `json:"description"`
	Source       string             `json:"source"`
	Tag          string             `json:"tag"`
	PublishedAt  time.Time          `json:"published_at"`
	Downloads    int                `json:"downloads"`
	Verified     bool               `json:"verified"`
	Inputs       []ModuleInput      `json:"inputs"`
	Outputs      []ModuleOutput     `json:"outputs"`
	Dependencies []ModuleDependency `json:"dependencies"`
	Resources    []ModuleResource   `json:"resources"`
}

ModuleDetails represents detailed module information

type ModuleInput

type ModuleInput struct {
	Name        string `json:"name"`
	Type        string `json:"type"`
	Description string `json:"description"`
	Default     any    `json:"default"`
	Required    bool   `json:"required"`
}

ModuleInput represents a module input variable

type ModuleOutput

type ModuleOutput struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

ModuleOutput represents a module output

type ModuleResource

type ModuleResource struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

ModuleResource represents a resource used by the module

type ModuleSearchResponse

type ModuleSearchResponse struct {
	Modules []Module     `json:"modules"`
	Meta    ResponseMeta `json:"meta"`
}

ModuleSearchResponse represents the response from module search

type Pagination

type Pagination struct {
	CurrentPage int `json:"current_page"`
	NextPage    int `json:"next_page"`
	PrevPage    int `json:"prev_page"`
	TotalPages  int `json:"total_pages"`
	TotalCount  int `json:"total_count"`
}

Pagination represents pagination information

type Platform

type Platform struct {
	OS   string `json:"os"`
	Arch string `json:"arch"`
}

Platform represents a platform for a provider version

type Policy

type Policy struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Downloads   int       `json:"downloads"`
	PublishedAt time.Time `json:"published_at"`
}

Policy represents a Terraform policy

type PolicyDetails

type PolicyDetails struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Downloads   int       `json:"downloads"`
	PublishedAt time.Time `json:"published_at"`
	Content     string    `json:"content"`
	Readme      string    `json:"readme"`
}

PolicyDetails represents detailed policy information

type PolicySearchResponse

type PolicySearchResponse struct {
	Policies []Policy     `json:"policies"`
	Meta     ResponseMeta `json:"meta"`
}

PolicySearchResponse represents the response from policy search

type ProviderDoc

type ProviderDoc struct {
	ID          string `json:"id"`
	Title       string `json:"title"`
	Path        string `json:"path"`
	Slug        string `json:"slug"`
	Category    string `json:"category"`
	Language    string `json:"language"`
	Subcategory string `json:"subcategory"`
}

ProviderDoc represents a single documentation item

type ProviderDocAttributes

type ProviderDocAttributes struct {
	Title       string `json:"title"`
	Category    string `json:"category"`
	Language    string `json:"language"`
	Subcategory string `json:"subcategory"`
	Path        string `json:"path"`
	Slug        string `json:"slug"`
}

ProviderDocAttributes represents attributes of a provider document

type ProviderDocV2

type ProviderDocV2 struct {
	ID         string                `json:"id"`
	Type       string                `json:"type"`
	Attributes ProviderDocAttributes `json:"attributes"`
}

ProviderDocV2 represents a provider document from v2 API

type ProviderDocs

type ProviderDocs struct {
	ID          string        `json:"id"`
	Owner       string        `json:"owner"`
	Namespace   string        `json:"namespace"`
	Name        string        `json:"name"`
	Version     string        `json:"version"`
	Tag         string        `json:"tag"`
	Description string        `json:"description"`
	Source      string        `json:"source"`
	Published   time.Time     `json:"published_at"`
	Downloads   int           `json:"downloads"`
	Verified    bool          `json:"verified"`
	Docs        []ProviderDoc `json:"docs"`
}

ProviderDocs represents the response from the v1 providers API

type ProviderDocsV2Response

type ProviderDocsV2Response struct {
	Data []ProviderDocV2 `json:"data"`
	Meta ResponseMeta    `json:"meta"`
}

ProviderDocsV2Response represents provider docs from v2 API

type ProviderOverviewAttributes

type ProviderOverviewAttributes struct {
	Description string `json:"description"`
	Source      string `json:"source"`
	Version     string `json:"version"`
}

ProviderOverviewAttributes represents the attributes of provider overview

type ProviderOverviewData

type ProviderOverviewData struct {
	ID         string                     `json:"id"`
	Type       string                     `json:"type"`
	Attributes ProviderOverviewAttributes `json:"attributes"`
}

ProviderOverviewData represents the data section of provider overview

type ProviderOverviewResponse

type ProviderOverviewResponse struct {
	Data ProviderOverviewData `json:"data"`
}

ProviderOverviewResponse represents provider overview from v2 API

type ProviderResourceAttributes

type ProviderResourceAttributes struct {
	Title       string `json:"title"`
	Category    string `json:"category"`
	Language    string `json:"language"`
	Subcategory string `json:"subcategory"`
	Path        string `json:"path"`
	Slug        string `json:"slug"`
	Content     string `json:"content"`
}

ProviderResourceAttributes represents the attributes of provider resource details

type ProviderResourceData

type ProviderResourceData struct {
	ID         string                     `json:"id"`
	Type       string                     `json:"type"`
	Attributes ProviderResourceAttributes `json:"attributes"`
}

ProviderResourceData represents the data section of provider resource details

type ProviderResourceDetails

type ProviderResourceDetails struct {
	Data ProviderResourceData `json:"data"`
}

ProviderResourceDetails represents detailed provider resource documentation

type ProviderVersion

type ProviderVersion struct {
	Version     string     `json:"version"`
	Protocols   []string   `json:"protocols"`
	Platforms   []Platform `json:"platforms"`
	PublishedAt time.Time  `json:"published_at"`
}

ProviderVersion represents a single provider version

type ProviderVersionAttributes

type ProviderVersionAttributes struct {
	Version     string    `json:"version"`
	PublishedAt time.Time `json:"published_at"`
}

ProviderVersionAttributes represents attributes of a provider version

type ProviderVersionV2

type ProviderVersionV2 struct {
	ID         string                    `json:"id"`
	Type       string                    `json:"type"`
	Attributes ProviderVersionAttributes `json:"attributes"`
}

ProviderVersionV2 represents a provider version from v2 API

type ProviderVersionsResponse

type ProviderVersionsResponse struct {
	Versions []ProviderVersion `json:"versions"`
}

ProviderVersionsResponse represents provider versions from v1 API

type ProviderVersionsV2Response

type ProviderVersionsV2Response struct {
	Data []ProviderVersionV2 `json:"data"`
	Meta ResponseMeta        `json:"meta"`
}

ProviderVersionsV2Response represents provider versions from v2 API

type ResponseMeta

type ResponseMeta struct {
	Pagination *Pagination `json:"pagination,omitempty"`
}

ResponseMeta represents common metadata in API responses

type TerraformDocumentationTool

type TerraformDocumentationTool struct {
	// contains filtered or unexported fields
}

TerraformDocumentationTool implements the tools.Tool interface

func (*TerraformDocumentationTool) Definition

func (t *TerraformDocumentationTool) Definition() mcp.Tool

Definition returns the tool's definition for MCP registration

func (*TerraformDocumentationTool) Execute

func (t *TerraformDocumentationTool) Execute(ctx context.Context, logger *logrus.Logger, cache *sync.Map, args map[string]any) (*mcp.CallToolResult, error)

Execute executes the tool's logic

func (*TerraformDocumentationTool) ProvideExtendedInfo

func (t *TerraformDocumentationTool) ProvideExtendedInfo() *tools.ExtendedHelp

ProvideExtendedInfo provides extended help information for the tool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL