# stacklet/cur-setup architecture

> Architecture diagram of the GitHub repository stacklet/cur-setup, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stacklet/cur-setup
- Repository: https://github.com/stacklet/cur-setup

## Overview

This repository provisions cloud cost-and-usage data exports for Stacklet: an organization administrator applies Terraform in the customer account or subscription, which sets up the provider-specific export and storage access Stacklet needs. AWS produces an hourly, resource-level CUR in Parquet and grants the Stacklet SaaS account limited S3 read access. Azure creates a Cost Management export and storage account that Stacklet reads using credentials configured in Stacklet. The source excerpts were unavailable, so resource relationships follow the README; implementation details beyond the file tree and documentation are not inferred.

Main entry points: [`terraform/s3.tf`](https://github.com/stacklet/cur-setup/blob/main/terraform/s3.tf) (CUR S3 bucket), [`terraform/cur.tf`](https://github.com/stacklet/cur-setup/blob/main/terraform/cur.tf) (Hourly CUR), [`terraform/cost_management.tf`](https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf) (Cost export job), [`terraform/variables.tf`](https://github.com/stacklet/cur-setup/blob/main/terraform/variables.tf) (Setup inputs)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shared["Shared inputs"]
  node_inputs["Setup inputs<br/>[variables.tf]"]
  node_locals["Resource naming<br/>[locals.tf]"]
end

subgraph group_aws["AWS CUR setup"]
  node_s3[("CUR S3 bucket<br/>[s3.tf]")]
  node_cur["Hourly CUR<br/>[cur.tf]"]
  node_aws_access["CUR read access<br/>[s3.tf]"]
end

subgraph group_azure["Azure exports"]
  node_resource_group["Resource group<br/>[cost_management.tf]"]
  node_storage[("Export storage<br/>[cost_management.tf]")]
  node_export["Cost export job<br/>[cost_management.tf]"]
end

node_admin(("Organization admin"))
node_stacklet(("Stacklet platform"))
node_aws_billing["AWS billing"]
node_azure_cost["Azure Cost Management"]

node_admin -->|"supplies values"| node_inputs
node_inputs -->|"configures names"| node_locals
node_admin -->|"provisions"| node_s3
node_admin -->|"provisions"| node_cur
node_admin -->|"provisions"| node_aws_access
node_cur -->|"configures report"| node_aws_billing
node_cur -->|"writes report"| node_s3
node_aws_access -->|"grants read access"| node_s3
node_stacklet -->|"reads CUR"| node_s3
node_admin -->|"provisions"| node_resource_group
node_admin -->|"provisions"| node_storage
node_admin -->|"provisions"| node_export
node_export -->|"configures export"| node_azure_cost
node_export -->|"writes exports"| node_storage
node_stacklet -->|"reads exports"| node_storage

click node_inputs "https://github.com/stacklet/cur-setup/blob/main/terraform/variables.tf"
click node_locals "https://github.com/stacklet/cur-setup/blob/main/terraform/locals.tf"
click node_s3 "https://github.com/stacklet/cur-setup/blob/main/terraform/s3.tf"
click node_cur "https://github.com/stacklet/cur-setup/blob/main/terraform/cur.tf"
click node_aws_access "https://github.com/stacklet/cur-setup/blob/main/terraform/s3.tf"
click node_resource_group "https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf"
click node_storage "https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf"
click node_export "https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_inputs,node_locals toneBlue
class node_s3,node_cur,node_aws_access toneAmber
class node_resource_group,node_storage,node_export toneMint
class node_admin,node_stacklet,node_aws_billing,node_azure_cost toneIndigo
```

## Components

### Shared inputs

- [Setup inputs](https://github.com/stacklet/cur-setup/blob/main/terraform/variables.tf): `terraform/variables.tf`
- [Resource naming](https://github.com/stacklet/cur-setup/blob/main/terraform/locals.tf): `terraform/locals.tf`

### AWS CUR setup

- [CUR S3 bucket](https://github.com/stacklet/cur-setup/blob/main/terraform/s3.tf): `terraform/s3.tf`
- [Hourly CUR](https://github.com/stacklet/cur-setup/blob/main/terraform/cur.tf): `terraform/cur.tf`
- [CUR read access](https://github.com/stacklet/cur-setup/blob/main/terraform/s3.tf): `terraform/s3.tf`

### Azure exports

- [Resource group](https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf): `terraform/cost_management.tf`
- [Export storage](https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf): `terraform/cost_management.tf`
- [Cost export job](https://github.com/stacklet/cur-setup/blob/main/terraform/cost_management.tf): `terraform/cost_management.tf`

### Other components

- **Organization admin**
- **Stacklet platform**
- **AWS billing**
- **Azure Cost Management**

## Connections

- Organization admin → Setup inputs: supplies values
- Setup inputs → Resource naming: configures names
- Organization admin → CUR S3 bucket: provisions
- Organization admin → Hourly CUR: provisions
- Organization admin → CUR read access: provisions
- Hourly CUR → AWS billing: configures report
- Hourly CUR → CUR S3 bucket: writes report
- CUR read access → CUR S3 bucket: grants read access
- Stacklet platform → CUR S3 bucket: reads CUR
- Organization admin → Resource group: provisions
- Organization admin → Export storage: provisions
- Organization admin → Cost export job: provisions
- Cost export job → Azure Cost Management: configures export
- Cost export job → Export storage: writes exports
- Stacklet platform → Export storage: reads exports
