Skip to content

Commit bd1e675

Browse files
committed
feat!: simplify stack output field names to stack and output
BREAKING CHANGE: Rename stack output resolver configuration fields - `stack_name` → `stack` - `output_key` → `output` This change makes stack output references more concise and readable while maintaining complete semantic clarity. The simplified field names reduce verbosity in configuration files without introducing ambiguity. Migration: Users must update their stackaroo.yaml configurations: ```yaml # Before type: stack-output stack_name: vpc-stack output_key: VpcId # After type: stack-output stack: vpc-stack output: VpcId ``` Automated migration can be performed with: ```bash sed -i 's/stack_name:/stack:/g' stackaroo.yaml sed -i 's/output_key:/output:/g' stackaroo.yaml ``` Changes: - Update StackOutputConfig struct and YAML tags - Update resolveStackOutput() parameter resolution logic - Update all tests to use new field names - Update all documentation and examples - Update example YAML configurations References: ADR 0022
1 parent 4b26c4a commit bd1e675

File tree

17 files changed

+459
-298
lines changed

17 files changed

+459
-298
lines changed

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ stacks:
139139
SecurityGroupIds:
140140
- sg-baseline123 # Literal value
141141
- type: stack-output # Dynamic from stack output
142-
stack_name: security-stack
143-
output_key: WebSGId
142+
stack: security-stack
143+
output: WebSGId
144144
- sg-additional456 # Another literal
145145

146146
# Simple literal list

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@ Pull values dynamically from existing CloudFormation stack outputs:
7676
parameters:
7777
VpcId:
7878
type: stack-output
79-
stack_name: networking
80-
output_key: VpcId
79+
stack: networking
80+
output: VpcId
8181

8282
DatabaseEndpoint:
8383
type: stack-output
84-
stack_name: database
85-
output_key: DatabaseEndpoint
84+
stack: database
85+
output: DatabaseEndpoint
8686
```
8787
8888
#### Cross-Region Stack Outputs
@@ -91,8 +91,8 @@ Reference outputs from stacks in different AWS regions:
9191
parameters:
9292
SharedBucketArn:
9393
type: stack-output
94-
stack_name: shared-resources
95-
output_key: BucketArn
94+
stack: shared-resources
95+
output: BucketArn
9696
region: us-east-1
9797
```
9898
@@ -104,8 +104,8 @@ parameters:
104104
SecurityGroupIds:
105105
- sg-baseline123 # Literal value
106106
- type: stack-output # Dynamic from stack output
107-
stack_name: security-stack
108-
output_key: WebSGId
107+
stack: security-stack
108+
output: WebSGId
109109
- sg-additional456 # Another literal
110110
111111
# Simple literal list
@@ -271,19 +271,19 @@ stacks:
271271
# Stack output parameters (pull from existing stacks)
272272
VpcId:
273273
type: stack-output
274-
stack_name: vpc
275-
output_key: VpcId
274+
stack: vpc
275+
output: VpcId
276276
277277
PrivateSubnetId:
278278
type: stack-output
279-
stack_name: vpc
280-
output_key: PrivateSubnet1Id
279+
stack: vpc
280+
output: PrivateSubnet1Id
281281
282282
# Cross-region stack output (optional region parameter)
283283
SharedBucketArn:
284284
type: stack-output
285-
stack_name: shared-resources
286-
output_key: BucketArn
285+
stack: shared-resources
286+
output: BucketArn
287287
region: us-east-1
288288
contexts:
289289
production:

docs/architecture/aws-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ parameters := map[string]*config.ParameterValue{
9898
"VpcId": {
9999
ResolutionType: "stack-output",
100100
ResolutionConfig: map[string]string{
101-
"stack_name": "vpc-stack",
102-
"output_key": "VpcId",
101+
"stack": "vpc-stack",
102+
"output": "VpcId",
103103
"region": "us-west-2", // Different region
104104
},
105105
},

docs/architecture/configuration.md

Lines changed: 52 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@ The configuration system follows these core architectural principles:
2929
graph TD
3030
A[CLI Layer] --> B[config.ConfigProvider Interface]
3131
B --> C[file.FileConfigProvider Implementation]
32-
32+
3333
C --> D[Raw YAML Parsing]
3434
C --> E[Resolution Engine]
3535
C --> F[Validation Engine]
3636
C --> G[Template Resolution]
37-
37+
3838
D --> H[YAML Configuration File]
3939
E --> H
4040
F --> H
4141
G --> H
42-
42+
4343
style A fill:#e1f5fe
4444
style B fill:#f3e5f5
4545
style C fill:#f1f8e9
@@ -54,13 +54,13 @@ graph TD
5454
type ConfigProvider interface {
5555
// LoadConfig loads configuration for a specific context
5656
LoadConfig(ctx context.Context, context string) (*Config, error)
57-
57+
5858
// ListContexts returns all available contexts
5959
ListContexts() ([]string, error)
60-
60+
6161
// GetStack returns stack configuration for specific stack and context
6262
GetStack(stackName, context string) (*StackConfig, error)
63-
63+
6464
// Validate checks configuration for consistency and errors
6565
Validate() error
6666
}
@@ -151,8 +151,8 @@ Dynamic references to CloudFormation stack outputs:
151151
parameters:
152152
VpcId:
153153
type: stack-output
154-
stack_name: vpc-stack
155-
output_key: VpcId
154+
stack: vpc-stack
155+
output: VpcId
156156
```
157157
158158
#### **List Parameters**
@@ -163,8 +163,8 @@ parameters:
163163
SecurityGroupIds:
164164
- sg-baseline123 # Literal value
165165
- type: stack-output # Dynamic resolution
166-
stack_name: security-stack
167-
output_key: WebSGId
166+
stack: security-stack
167+
output: WebSGId
168168
- sg-additional456 # Another literal
169169
170170
# Simple literal list
@@ -178,7 +178,7 @@ parameters:
178178

179179
1. **YAML Parsing** - `yamlParameterValue.UnmarshalYAML()` detects parameter type:
180180
- Scalar nodes → Literal parameters
181-
- Mapping nodes → Resolver parameters
181+
- Mapping nodes → Resolver parameters
182182
- Sequence nodes → List parameters
183183

184184
2. **Configuration Conversion** - `ToConfigParameterValue()` creates unified `ParameterValue` structures
@@ -197,8 +197,8 @@ List parameters resolve to comma-separated strings compatible with CloudFormatio
197197
SecurityGroupIds:
198198
- sg-123
199199
- type: stack-output
200-
stack_name: vpc-stack
201-
output_key: WebSGId # Resolves to "sg-456"
200+
stack: vpc-stack
201+
output: WebSGId # Resolves to "sg-456"
202202
203203
# Resolved Parameter Value
204204
SecurityGroupIds: "sg-123,sg-456"
@@ -224,19 +224,19 @@ stacks:
224224
SecurityGroupIds:
225225
- sg-base
226226
- type: stack-output
227-
stack_name: security
228-
output_key: WebSGId
227+
stack: security
228+
output: WebSGId
229229
contexts:
230230
prod:
231231
parameters:
232232
SecurityGroupIds:
233233
- sg-prod-base # Different baseline for prod
234234
- type: stack-output
235-
stack_name: security
236-
output_key: WebSGId
235+
stack: security
236+
output: WebSGId
237237
- type: stack-output # Additional monitoring SG
238-
stack_name: monitoring
239-
output_key: MonitoringSGId
238+
stack: monitoring
239+
output: MonitoringSGId
240240
```
241241

242242
### Error Handling
@@ -254,7 +254,7 @@ The system is designed for extensibility with new resolution types:
254254
// Future resolver types can be added easily
255255
switch paramValue.ResolutionType {
256256
case "literal": // Existing
257-
case "stack-output": // Existing
257+
case "stack-output": // Existing
258258
case "list": // Existing
259259
case "ssm-parameter": // Future: Systems Manager parameters
260260
case "secrets-manager": // Future: Secrets Manager values
@@ -320,7 +320,7 @@ type yamlParameterValue struct {
320320

321321
// For complex resolution
322322
Resolver *yamlParameterResolver
323-
323+
324324
// For list parameters - detected from YAML arrays
325325
ListItems []*yamlParameterValue
326326
IsListValue bool
@@ -338,7 +338,7 @@ graph LR
338338
A[YAML: templates/vpc.yaml] --> B[resolveTemplatePath]
339339
B --> C[Absolute Path: /project/templates/vpc.yaml]
340340
C --> D[file:// URI: file:///project/templates/vpc.yaml]
341-
341+
342342
style A fill:#fff3e0
343343
style D fill:#e8f5e8
344344
```
@@ -351,10 +351,10 @@ Parameters are resolved using a three-level inheritance hierarchy:
351351
graph TD
352352
A[Global Parameters<br/>file.Config.*] --> B[Stack Parameters<br/>file.Stack.Parameters]
353353
B --> C[Context Parameters<br/>file.ContextOverride.Parameters]
354-
354+
355355
A -.->|inherited by| B
356356
B -.->|overridden by| C
357-
357+
358358
style A fill:#ffebee
359359
style B fill:#f3e5f5
360360
style C fill:#e8f5e8
@@ -369,11 +369,11 @@ graph TD
369369
A[Global Tags<br/>file.Config.Tags] --> B[Context Tags<br/>file.Context.Tags]
370370
B --> C[Stack Tags<br/>file.Stack.Tags]
371371
C --> D[Context Override Tags<br/>file.ContextOverride.Tags]
372-
372+
373373
A -.->|merged with| B
374374
B -.->|merged with| C
375375
C -.->|overridden by| D
376-
376+
377377
style A fill:#ffebee
378378
style B fill:#fff3e0
379379
style C fill:#f3e5f5
@@ -387,16 +387,16 @@ flowchart TD
387387
A[Start: Stack Configuration] --> B[Apply Stack Defaults]
388388
B --> C[Apply Global Defaults]
389389
C --> D{Context Override Exists?}
390-
390+
391391
D -->|Yes| E[Merge Context Parameters<br/>Context Wins]
392392
D -->|No| H[Resolve Template Path]
393-
393+
394394
E --> F[Merge Context Tags<br/>Context Wins]
395395
F --> G[Replace Dependencies & Capabilities<br/>if specified]
396396
G --> H[Convert Template Path to URI<br/>file:// scheme for file paths]
397-
397+
398398
H --> I[Return Resolved StackConfig]
399-
399+
400400
style A fill:#e3f2fd
401401
style I fill:#e8f5e8
402402
style D fill:#fff9c4
@@ -422,14 +422,14 @@ contexts:
422422
tags:
423423
Environment: dev
424424
CostCenter: engineering
425-
425+
426426
staging:
427427
account: "123456789012"
428428
region: us-east-1
429429
tags:
430430
Environment: staging
431431
CostCenter: engineering
432-
432+
433433
prod:
434434
account: "987654321098"
435435
region: us-east-1
@@ -445,15 +445,15 @@ stacks:
445445
# Simple literal parameters (traditional syntax)
446446
VpcCidr: 10.0.0.0/16
447447
EnableDnsHostnames: "true"
448-
448+
449449
# List parameter with mixed resolution types
450450
SecurityGroupIds:
451451
- sg-baseline123 # Literal value
452452
- type: stack-output # Dynamic from stack output
453-
stack_name: security-stack
454-
output_key: WebSGId
453+
stack: security-stack
454+
output: WebSGId
455455
- sg-additional456 # Another literal
456-
456+
457457
# Simple list of literals
458458
AllowedPorts:
459459
- "80"
@@ -471,23 +471,23 @@ stacks:
471471
SecurityGroupIds:
472472
- sg-dev-baseline
473473
- type: stack-output
474-
stack_name: dev-security
475-
output_key: DevWebSGId
474+
stack: dev-security
475+
output: DevWebSGId
476476
prod:
477477
parameters:
478478
VpcCidr: 10.2.0.0/16
479479
# Production includes additional security groups
480480
SecurityGroupIds:
481481
- sg-prod-baseline
482482
- type: stack-output
483-
stack_name: security-stack
484-
output_key: WebSGId
483+
stack: security-stack
484+
output: WebSGId
485485
- type: stack-output
486-
stack_name: monitoring-stack
487-
output_key: MonitoringSGId
486+
stack: monitoring-stack
487+
output: MonitoringSGId
488488
tags:
489489
Component: prod-networking
490-
490+
491491
- name: database
492492
template: templates/rds.yaml
493493
depends_on: [vpc]
@@ -496,14 +496,14 @@ stacks:
496496
# Database subnets from VPC stack
497497
DBSubnetGroupSubnetIds:
498498
- type: stack-output
499-
stack_name: vpc
500-
output_key: DatabaseSubnet1Id
499+
stack: vpc
500+
output: DatabaseSubnet1Id
501501
- type: stack-output
502-
stack_name: vpc
503-
output_key: DatabaseSubnet2Id
502+
stack: vpc
503+
output: DatabaseSubnet2Id
504504
- type: stack-output
505-
stack_name: vpc
506-
output_key: DatabaseSubnet3Id
505+
stack: vpc
506+
output: DatabaseSubnet3Id
507507
contexts:
508508
prod:
509509
parameters:
@@ -764,10 +764,10 @@ The configuration system follows the testing patterns established in [ADR 0011](
764764
func createTempConfigFile(t *testing.T, content string) string {
765765
tmpDir := t.TempDir()
766766
tmpFile := tmpDir + "/stackaroo.yaml"
767-
767+
768768
err := os.WriteFile(tmpFile, []byte(content), 0644)
769769
require.NoError(t, err)
770-
770+
771771
return tmpFile
772772
}
773773
```
@@ -809,4 +809,4 @@ func createTempConfigFile(t *testing.T, content string) string {
809809
- IDE plugins for configuration validation
810810
- CI/CD pipeline integration
811811
- Configuration drift detection
812-
- Automated parameter discovery from templates
812+
- Automated parameter discovery from templates

docs/architecture/decisions/0017-parameter-resolution-system.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Accepted
88

99
Amends [ADR 0010: File provider configuration structure](0010-file-provider-configuration-structure.md)
1010

11+
Amended by [ADR 0022: Simplified stack output reference field names](0022-simplified-stack-output-field-names.md)
12+
1113
## Context
1214

1315
The original configuration system implemented in ADR 0010 established a parameter structure using simple `map[string]string` values, which worked well for basic CloudFormation parameters but had significant limitations:

0 commit comments

Comments
 (0)