Azure / Azure/azure-dev

Resource Discoverability

Open
#6,230 0 comments 0 reactions 0 assignees View on GitHub
area/ext-framework area/extensions feature
Dominant language
Go
Stars
569
Forks
364
Avg merge
2d 19h
Merged PRs (30d)
136

Description

## Description

Enable extension developers to define and register custom resource types for the upcoming v2 composability model, making these resources discoverable and available through `azd add` commands. This allows extensions to extend beyond azd's built-in resource types with custom resources, composite types, or pattern-based modules.

## Context: V2 Composability Model

In the upcoming v2 composability model, resources will become extensible:
- Core `azd` provides built-in resource types (e.g., Azure App Service, Container Apps, Storage)
- Extensions can define additional resource types for:
- Custom Azure resources not yet supported by core `azd`
- Composite resource patterns (e.g., "web app with database and cache")
- Multi-resource modules following organizational best practices
- Third-party or hybrid cloud resources

## Acceptance Criteria

- Extension API for registering custom resource type definitions
- Resource type discovery mechanism accessible to `azd` core
- Discovered resource types integrated into `azd add` command flow
- Resource type definitions include:
- Resource type name and description
- IaC templates/modules (Bicep, Terraform, etc.)
- Resource-specific manifest describing requirements and connections
- Parameters and configuration schema
- Dependencies and prerequisites
- User can run `azd add ` to add custom resources
- Discoverability commands (e.g., `azd add --list` shows extension resources)

## Resource Type Components

### 1. IaC Resources
- Bicep modules, Terraform configurations, or other IaC templates
- Parameterized for customization
- Follow Azure best practices and naming conventions

### 2. Resource Manifest
- Describes resource requirements (SKU, region, dependencies)
- Defines connection strings and outputs available to other services
- Configuration schema for user inputs
- Metadata for resource discovery and documentation

### 3. Integration Points
- How resource integrates with other services (connection patterns)
- Environment variables or configuration injection
- Dependency resolution and ordering

## Use Cases

### 1. Custom Azure Resources
- Extension provides resource type for Azure AI Search
- Extension provides resource type for Azure API Management
- Extension provides resource type for Azure Event Grid

### 2. Composite Resource Patterns
- "Modern Web App" = App Service + SQL Database + Redis Cache + Application Insights
- "Microservice" = Container App + Service Bus + Key Vault
- "Data Pipeline" = Data Factory + Storage + SQL Database

### 3. Organizational Patterns
- Company-specific resource modules following internal standards
- Pre-configured resources with compliance requirements
- Multi-environment resource templates (dev, staging, prod)

### 4. Multi-Cloud or Hybrid
- On-premises resources in hybrid architectures
- Third-party SaaS integrations

## Proposed Implementation

### 1. Resource Type Registration API
```go
type ResourceTypeProvider interface {
GetResourceTypes(ctx context.Context) ([]ResourceType, error)
GetResourceTemplate(ctx context.Context, resourceType string) (*ResourceTemplate, error)
}

type ResourceType struct {
Name string
DisplayName string
Description string
Category string
Parameters []Parameter
}
```

### 2. Discovery Flow
- Extensions register resource type providers via manifest
- `azd` queries providers on demand (lazy loading)
- Resource types cached for performance
- `azd add --list` aggregates built-in + extension resource types

### 3. Add Command Integration
- `azd add ` supports both built-in and extension resources
- Interactive prompt shows all available resources with source (built-in vs. extension)
- Extension resources validated before addition
- IaC templates copied/generated into project

## Related Issues

- #5767 (Extension Enhancements Epic) - Core composability feature

## Benefits

- Extensible resource ecosystem beyond azd core team bandwidth
- Faster adoption of new Azure services through extensions
- Organizations can codify internal best practices as reusable resources
- Reduced duplication through composite resource patterns
- Community-driven resource library
- Enables "marketplace" of proven resource patterns

## Additional Considerations

- Resource type versioning and compatibility
- Validation and testing framework for extension resources
- Resource type deprecation and migration paths
- Conflict resolution when multiple extensions provide similar resources
- Resource documentation and examples requirements
- Security and compliance validation for extension resources
- Performance impact of resource discovery
- Integration with `azd init` for automatic resource detection
- Telemetry on usage of built-in vs. extension resources

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.