@fractary/core 0.7.25 → 0.7.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/common/yaml-config.d.ts +15 -0
- package/dist/common/yaml-config.d.ts.map +1 -1
- package/dist/common/yaml-config.js.map +1 -1
- package/dist/config/__tests__/loader.test.js +84 -34
- package/dist/config/__tests__/loader.test.js.map +1 -1
- package/dist/config/defaults.d.ts +82 -2
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +112 -6
- package/dist/config/defaults.js.map +1 -1
- package/dist/config/defaults.test.js +226 -1
- package/dist/config/defaults.test.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +2 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/loader.d.ts +8 -6
- package/dist/config/loader.d.ts.map +1 -1
- package/dist/config/loader.js +49 -37
- package/dist/config/loader.js.map +1 -1
- package/dist/config/schema.d.ts +12 -12
- package/dist/repo/config.d.ts +14 -11
- package/dist/repo/config.d.ts.map +1 -1
- package/dist/repo/config.js +59 -16
- package/dist/repo/config.js.map +1 -1
- package/dist/repo/config.test.js +9 -14
- package/dist/repo/config.test.js.map +1 -1
- package/dist/repo/path-generator.d.ts +6 -6
- package/dist/repo/path-generator.d.ts.map +1 -1
- package/dist/repo/path-generator.js +12 -8
- package/dist/repo/path-generator.js.map +1 -1
- package/dist/repo/path-generator.test.d.ts +1 -1
- package/dist/repo/path-generator.test.js +61 -82
- package/dist/repo/path-generator.test.js.map +1 -1
- package/dist/work/providers/github.d.ts.map +1 -1
- package/dist/work/providers/github.js +10 -2
- package/dist/work/providers/github.js.map +1 -1
- package/package.json +1 -1
- package/templates/terraform/r2.tf.mustache +78 -0
- package/templates/terraform/s3.tf.mustache +204 -0
- package/templates/terraform/variables.tf.mustache +47 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Fractary Cloud Storage - AWS S3
|
|
2
|
+
#
|
|
3
|
+
# This Terraform configuration creates an S3 bucket for Fractary Core
|
|
4
|
+
# file storage (docs and logs archival).
|
|
5
|
+
#
|
|
6
|
+
# Generated by: fractary-core config cloud-init --provider s3
|
|
7
|
+
#
|
|
8
|
+
# Usage:
|
|
9
|
+
# cd infra/terraform
|
|
10
|
+
# terraform init
|
|
11
|
+
# terraform plan
|
|
12
|
+
# terraform apply
|
|
13
|
+
|
|
14
|
+
terraform {
|
|
15
|
+
required_version = ">= 1.0"
|
|
16
|
+
|
|
17
|
+
required_providers {
|
|
18
|
+
aws = {
|
|
19
|
+
source = "hashicorp/aws"
|
|
20
|
+
version = "~> 5.0"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
provider "aws" {
|
|
26
|
+
region = var.aws_region
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# --- S3 Bucket ---
|
|
30
|
+
|
|
31
|
+
resource "aws_s3_bucket" "fractary" {
|
|
32
|
+
bucket = var.bucket_name
|
|
33
|
+
|
|
34
|
+
tags = {
|
|
35
|
+
Name = var.bucket_name
|
|
36
|
+
ManagedBy = "fractary-core"
|
|
37
|
+
Project = var.project_name
|
|
38
|
+
Environment = "dev"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Enable versioning for data protection
|
|
43
|
+
resource "aws_s3_bucket_versioning" "fractary" {
|
|
44
|
+
bucket = aws_s3_bucket.fractary.id
|
|
45
|
+
|
|
46
|
+
versioning_configuration {
|
|
47
|
+
status = "Enabled"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
# Server-side encryption (AES-256)
|
|
52
|
+
resource "aws_s3_bucket_server_side_encryption_configuration" "fractary" {
|
|
53
|
+
bucket = aws_s3_bucket.fractary.id
|
|
54
|
+
|
|
55
|
+
rule {
|
|
56
|
+
apply_server_side_encryption_by_default {
|
|
57
|
+
sse_algorithm = "AES256"
|
|
58
|
+
}
|
|
59
|
+
bucket_key_enabled = true
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
# Block all public access
|
|
64
|
+
resource "aws_s3_bucket_public_access_block" "fractary" {
|
|
65
|
+
bucket = aws_s3_bucket.fractary.id
|
|
66
|
+
|
|
67
|
+
block_public_acls = true
|
|
68
|
+
block_public_policy = true
|
|
69
|
+
ignore_public_acls = true
|
|
70
|
+
restrict_public_buckets = true
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
# Lifecycle rules for cost optimization
|
|
74
|
+
resource "aws_s3_bucket_lifecycle_configuration" "fractary" {
|
|
75
|
+
bucket = aws_s3_bucket.fractary.id
|
|
76
|
+
|
|
77
|
+
# Transition archived logs to Infrequent Access after 90 days
|
|
78
|
+
rule {
|
|
79
|
+
id = "archive-logs-transition"
|
|
80
|
+
status = "Enabled"
|
|
81
|
+
|
|
82
|
+
filter {
|
|
83
|
+
prefix = "logs/_archive/"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
transition {
|
|
87
|
+
days = 90
|
|
88
|
+
storage_class = "STANDARD_IA"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
transition {
|
|
92
|
+
days = 365
|
|
93
|
+
storage_class = "GLACIER"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Transition archived docs to Infrequent Access after 90 days
|
|
98
|
+
rule {
|
|
99
|
+
id = "archive-docs-transition"
|
|
100
|
+
status = "Enabled"
|
|
101
|
+
|
|
102
|
+
filter {
|
|
103
|
+
prefix = "docs/_archive/"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
transition {
|
|
107
|
+
days = 90
|
|
108
|
+
storage_class = "STANDARD_IA"
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
transition {
|
|
112
|
+
days = 365
|
|
113
|
+
storage_class = "GLACIER"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
# Clean up incomplete multipart uploads
|
|
118
|
+
rule {
|
|
119
|
+
id = "cleanup-multipart"
|
|
120
|
+
status = "Enabled"
|
|
121
|
+
|
|
122
|
+
filter {}
|
|
123
|
+
|
|
124
|
+
abort_incomplete_multipart_upload {
|
|
125
|
+
days_after_initiation = 7
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
# --- IAM Policy ---
|
|
131
|
+
|
|
132
|
+
# IAM policy document scoped to Fractary prefixes only
|
|
133
|
+
data "aws_iam_policy_document" "fractary_access" {
|
|
134
|
+
statement {
|
|
135
|
+
sid = "FractaryListBucket"
|
|
136
|
+
effect = "Allow"
|
|
137
|
+
|
|
138
|
+
actions = [
|
|
139
|
+
"s3:ListBucket",
|
|
140
|
+
]
|
|
141
|
+
|
|
142
|
+
resources = [
|
|
143
|
+
aws_s3_bucket.fractary.arn,
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
condition {
|
|
147
|
+
test = "StringLike"
|
|
148
|
+
variable = "s3:prefix"
|
|
149
|
+
values = [
|
|
150
|
+
"logs/*",
|
|
151
|
+
"docs/*",
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
statement {
|
|
157
|
+
sid = "FractaryObjectAccess"
|
|
158
|
+
effect = "Allow"
|
|
159
|
+
|
|
160
|
+
actions = [
|
|
161
|
+
"s3:GetObject",
|
|
162
|
+
"s3:PutObject",
|
|
163
|
+
"s3:DeleteObject",
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
resources = [
|
|
167
|
+
"${aws_s3_bucket.fractary.arn}/logs/*",
|
|
168
|
+
"${aws_s3_bucket.fractary.arn}/docs/*",
|
|
169
|
+
]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
resource "aws_iam_policy" "fractary_access" {
|
|
174
|
+
name = "fractary-${var.project_name}-storage-access"
|
|
175
|
+
description = "Scoped access to Fractary storage bucket for ${var.project_name}"
|
|
176
|
+
policy = data.aws_iam_policy_document.fractary_access.json
|
|
177
|
+
|
|
178
|
+
tags = {
|
|
179
|
+
ManagedBy = "fractary-core"
|
|
180
|
+
Project = var.project_name
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
# --- Outputs ---
|
|
185
|
+
|
|
186
|
+
output "bucket_name" {
|
|
187
|
+
description = "The name of the Fractary S3 bucket"
|
|
188
|
+
value = aws_s3_bucket.fractary.bucket
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
output "bucket_arn" {
|
|
192
|
+
description = "The ARN of the Fractary S3 bucket"
|
|
193
|
+
value = aws_s3_bucket.fractary.arn
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
output "bucket_region" {
|
|
197
|
+
description = "The region of the Fractary S3 bucket"
|
|
198
|
+
value = aws_s3_bucket.fractary.region
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
output "iam_policy_arn" {
|
|
202
|
+
description = "The ARN of the IAM policy for Fractary bucket access"
|
|
203
|
+
value = aws_iam_policy.fractary_access.arn
|
|
204
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Fractary Cloud Storage - Shared Variables
|
|
2
|
+
#
|
|
3
|
+
# Variables used by the Fractary cloud storage Terraform configuration.
|
|
4
|
+
# Override defaults via terraform.tfvars or -var flags.
|
|
5
|
+
|
|
6
|
+
# --- Common Variables ---
|
|
7
|
+
|
|
8
|
+
variable "project_name" {
|
|
9
|
+
description = "Project name (used for resource naming and tags)"
|
|
10
|
+
type = string
|
|
11
|
+
default = "{{repo}}"
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
variable "bucket_name" {
|
|
15
|
+
description = "Name of the storage bucket"
|
|
16
|
+
type = string
|
|
17
|
+
default = "{{bucket}}"
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# --- AWS S3 Variables ---
|
|
21
|
+
|
|
22
|
+
variable "aws_region" {
|
|
23
|
+
description = "AWS region for the S3 bucket"
|
|
24
|
+
type = string
|
|
25
|
+
default = "{{region}}"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
# --- Cloudflare R2 Variables ---
|
|
29
|
+
|
|
30
|
+
variable "cloudflare_account_id" {
|
|
31
|
+
description = "Cloudflare account ID"
|
|
32
|
+
type = string
|
|
33
|
+
default = "{{account_id}}"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
variable "cloudflare_api_token" {
|
|
37
|
+
description = "Cloudflare API token with R2 permissions"
|
|
38
|
+
type = string
|
|
39
|
+
sensitive = true
|
|
40
|
+
default = ""
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
variable "r2_location" {
|
|
44
|
+
description = "R2 bucket location hint (auto, wnam, enam, weur, eeur, apac)"
|
|
45
|
+
type = string
|
|
46
|
+
default = "auto"
|
|
47
|
+
}
|