Skip to main content
Glama

get_terraform_resource_info

Retrieve detailed schema and documentation for a specific Terraform resource by providing the provider and resource name, aiding Infrastructure-as-Code development and management.

Instructions

Retrieve comprehensive information about a Terraform resource including schema and documentation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
provider_nameYesName of the Terraform provider
resource_nameYesName of the resource

Implementation Reference

  • Main handler function executing the tool logic: logs input, fetches resource info using get_resource_info helper, formats output with details and schema, handles errors.
    async def handle_get_terraform_resource_info( db: Any, arguments: Dict[str, Any], operation_id: str ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: """Handle get_terraform_resource_info tool.""" try: logger.info( "Getting resource info", extra={ "provider_name": arguments["provider_name"], "resource_name": arguments["resource_name"], "operation_id": operation_id, }, ) # Get resource info resource = get_resource_info( db, arguments["resource_name"], provider_name=arguments["provider_name"] ) if not resource: error_msg = f"Resource '{arguments['resource_name']}' not found for provider '{arguments['provider_name']}'" logger.error(error_msg, extra={"operation_id": operation_id}) return [types.TextContent( type="text", text=error_msg )] # Format output output = [ f"Resource: {resource['name']}", f"Provider: {resource['provider_name']}", f"Type: {resource['resource_type']}", f"Version: {resource['version']}", f"Documentation: {resource['doc_url']}", "\nSchema:", resource["schema"], ] return [types.TextContent( type="text", text="\n".join(output) )] except Exception as e: error_msg = f"Failed to get resource info: {str(e)}" logger.error(error_msg, extra={"operation_id": operation_id}) return [types.TextContent(type="text", text=error_msg)]
  • Input schema validation for the tool, specifying required provider_name and resource_name as strings.
    "get_terraform_resource_info": { "type": "object", "description": "Retrieve comprehensive information about a Terraform resource including schema and documentation", "required": ["provider_name", "resource_name"], "properties": { "provider_name": { "type": "string", "description": "Name of the Terraform provider", }, "resource_name": {"type": "string", "description": "Name of the resource"}, }, },
  • Local registration mapping the tool name to its handler function within the terraform tools handlers dictionary.
    terraform_tool_handlers = { "get_terraform_provider_info": handle_get_terraform_provider_info, "list_provider_resources": handle_list_provider_resources, "get_terraform_resource_info": handle_get_terraform_resource_info, "add_terraform_provider": handle_add_terraform_provider, "add_terraform_resource": handle_add_terraform_resource, "update_provider_version": handle_update_provider_version, }
  • Input schema validation for the tool, specifying required provider_name and resource_name as strings.
    "get_terraform_resource_info": { "type": "object", "description": "Retrieve comprehensive information about a Terraform resource including schema and documentation", "required": ["provider_name", "resource_name"], "properties": { "provider_name": { "type": "string", "description": "Name of the Terraform provider", }, "resource_name": {"type": "string", "description": "Name of the resource"}, }, },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AgentWong/iac-memory-mcp-server-project'

If you have feedback or need assistance with the MCP directory API, please join our Discord server