# bsquare-corp/terraform-provider-skopeo2 architecture

> Architecture diagram of the GitHub repository bsquare-corp/terraform-provider-skopeo2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bsquare-corp/terraform-provider-skopeo2
- Repository: https://github.com/bsquare-corp/terraform-provider-skopeo2

## Overview

##### Main Components

a. Core Provider Components:
- Provider Configuration Layer
- Main provider setup (internal/provider/provider.go)
- Resource definitions (internal/provider/resource_skopeo2_copy.go)

b. Internal Service Layer:
- Skopeo Integration Service (internal/skopeo/)
- Copy operations
- Inspect operations
- Login handling
- Context management

c. External Interfaces:
- Terraform Plugin SDK Integration
- Container Registry Interactions
- Authentication Systems

**┌─────────────────────────────────────────────┐**
- Terraform Core                   │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Terraform Plugin SDK                │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Skopeo2 Provider Interface Layer         │
- ┌─────────────┐  ┌────────────────────┐   │
- Provider   │  │ Resource: Copy     │   │
- Configuration│  │                    │   │
- ┘  └────────────────────┘   │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Internal Skopeo Integration Layer        │
- ┌─────────┐ ┌───────┐ ┌───────┐ ┌─────┐  │
- Copy   │ │Inspect│ │ Login │ │Utils│  │
- ┘ └───────┘ └───────┘ └─────┘  │
- ┘
- ↕
**┌─────────────────────────────────────────────┐**
- Container Registries                │
- ┘

##### Important Details to Highlight

a. Provider Configuration Flow:
- How the provider initializes and configures Skopeo operations
- Authentication flow for container registries

b. Resource Operations:
- Copy resource's CRUD operations
- Interaction with the Skopeo integration layer

c. Integration Points:
- Interfaces with external container registries
- Authentication mechanisms

##### Technical Details
- Go version requirement (>= 1.19)
- Terraform version compatibility (>= 0.13.x)
- Key dependencies and their versions

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef terraform fill:#4285F4,color:white
    classDef provider fill:#34A853,color:white
    classDef integration fill:#FBBC05,color:white
    classDef external fill:#EA4335,color:white
    classDef docs fill:#9334E6,color:white

    %% Terraform Core Layer
    TF[Terraform Core]:::terraform

    %% Plugin SDK Layer
    SDK[Terraform Plugin SDK]:::terraform

    %% Provider Interface Layer
    subgraph Provider
        PC[Provider Configuration]:::provider
        RC[Resource: Copy]:::provider
        PT[Provider Tests]:::provider
        RT[Resource Tests]:::provider
    end

    %% Skopeo Integration Layer
    subgraph Integration
        CO[Copy Operations]:::integration
        IN[Inspect Operations]:::integration
        LG[Login Handler]:::integration
        CT[Context Manager]:::integration
        UT[Utilities]:::integration
        IT[Integration Tests]:::integration
    end

    %% Documentation Layer
    subgraph Documentation
        PD[Provider Docs]:::docs
        RD[Resource Docs]:::docs
        EX[Examples]:::docs
    end

    %% External Systems
    CR[Container Registries]:::external

    %% Relationships
    TF --> SDK
    SDK --> PC
    PC --> RC
    PC --> PT
    RC --> RT
    RC --> CO
    RC --> IN
    CO --> LG
    CO --> CT
    IN --> LG
    IN --> CT
    LG --> UT
    CO --> CR
    IN --> CR
    LG --> CR

    %% Click events for component mapping
    click PC "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/provider/provider.go"
    click RC "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/provider/resource_skopeo2_copy.go"
    click CO "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/skopeo/copy.go"
    click IN "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/skopeo/inspect.go"
    click LG "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/skopeo/login.go"
    click CT "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/skopeo/context.go"
    click UT "https://github.com/bsquare-corp/terraform-provider-skopeo2/tree/main/pkg/skopeo"
    click PD "https://github.com/bsquare-corp/terraform-provider-skopeo2/tree/main/docs"
    click RD "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/docs/resources/copy.md"
    click EX "https://github.com/bsquare-corp/terraform-provider-skopeo2/tree/main/examples"
    click PT "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/provider/provider_test.go"
    click RT "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/provider/resource_skopeo2_copy_test.go"
    click IT "https://github.com/bsquare-corp/terraform-provider-skopeo2/blob/main/internal/skopeo/copy_test.go"
```
