Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit dccdb35

Browse files
author
Aaron Dernley
committed
fix(clover): cloudformation only asset overhaul
1 parent f1a4737 commit dccdb35

11 files changed

Lines changed: 460 additions & 102 deletions

File tree

‎bin/clover/src/pipelines/aws/funcs.ts‎

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ export const CODE_GENERATION_FUNC_SPECS = {
6464
displayName: "Code Gen for use in validating a Cloudformation document",
6565
path: "./src/pipelines/aws/funcs/code-gen/awsCloudFormationLint.ts",
6666
},
67+
awsCfOnlyCodeGen: {
68+
id: "f66e1afc8ff0f43f3b8a15c87f0a916243904de894e33322beb7f84dc792305a",
69+
backendKind: "jsAttribute",
70+
responseType: "codeGeneration",
71+
displayName: "Code Gen for CloudFormation-only assets",
72+
path: "./src/pipelines/aws/funcs/code-gen/awsCfOnlyCodeGen.ts",
73+
},
6774
} as const satisfies Record<string, FuncSpecInfo>;
6875

6976
export const MANAGEMENT_FUNCS = {
@@ -89,7 +96,12 @@ export const MANAGEMENT_FUNCS = {
8996
FuncSpecInfo & { handlers: CfHandlerKind[] }
9097
>;
9198

92-
export const QUALIFICATION_FUNC_SPECS = {} as const as Record<
93-
string,
94-
FuncSpecInfo
95-
>;
99+
export const QUALIFICATION_FUNC_SPECS = {
100+
awsCfOnlyLint: {
101+
id: "dba872348ce39bfa8c15002037263b2528d81833c6c1f24fef5c9bc4115145b4",
102+
backendKind: "jsAttribute",
103+
responseType: "qualification",
104+
displayName: "CloudFormation Lint Validation",
105+
path: "./src/pipelines/aws/funcs/qualifications/awsCfOnlyLint.ts",
106+
},
107+
} as const satisfies Record<string, FuncSpecInfo>;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
async function main({
2+
properties,
3+
extra
4+
}: Input): Promise<Output> {
5+
if (!properties) {
6+
return null;
7+
}
8+
return JSON.stringify({
9+
Type: extra?.AwsResourceType,
10+
Properties: properties
11+
}, null, 2);
12+
}

‎bin/clover/src/pipelines/aws/funcs/attribute/awsCloudControlCfAssetAttr.ts‎

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
async function main(component: Input): Promise<Output> {
2+
const resourceBody = component.domain?.CloudFormationResourceBody;
3+
4+
if (!resourceBody) {
5+
return {
6+
format: "json",
7+
code: JSON.stringify(
8+
{
9+
AWSTemplateFormatVersion: "2010-09-09",
10+
Resources: {},
11+
},
12+
null,
13+
2,
14+
),
15+
};
16+
}
17+
18+
// CloudFormationResourceBody is already a JSON string from the attribute function
19+
const resource = JSON.parse(resourceBody);
20+
21+
const cloudFormationTemplate = {
22+
AWSTemplateFormatVersion: "2010-09-09",
23+
Resources: {
24+
cfnResource: resource,
25+
},
26+
};
27+
28+
return {
29+
format: "json",
30+
code: JSON.stringify(cloudFormationTemplate, null, 2),
31+
};
32+
}

‎bin/clover/src/pipelines/aws/funcs/overrides/AWS::Route53::RecordSet/actions/create.ts‎

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ async function main(component: Input): Promise<Output> {
77
};
88
}
99

10-
const domain = component.properties?.domain;
11-
const hostedZoneId = domain?.HostedZoneId;
12-
const name = domain?.Name;
13-
const type = domain?.Type;
10+
// Changed: access via domain.properties
11+
const properties = component.properties?.domain?.properties;
12+
const hostedZoneId = properties?.HostedZoneId;
13+
const name = properties?.Name;
14+
const type = properties?.Type;
1415

1516
if (!hostedZoneId) {
1617
return {
@@ -40,24 +41,26 @@ async function main(component: Input): Promise<Output> {
4041
ResourceRecordSet: {
4142
Name: name,
4243
Type: type,
43-
TTL: domain?.TTL ? parseInt(domain.TTL) : undefined,
44-
ResourceRecords: domain?.ResourceRecords?.map((record: string) => ({
45-
Value: record,
46-
})),
47-
AliasTarget: domain?.AliasTarget
44+
TTL: properties?.TTL ? parseInt(properties.TTL) : undefined,
45+
ResourceRecords: properties?.ResourceRecords?.map(
46+
(record: string) => ({
47+
Value: record,
48+
}),
49+
),
50+
AliasTarget: properties?.AliasTarget
4851
? {
49-
DNSName: domain.AliasTarget.DNSName,
50-
EvaluateTargetHealth: domain.AliasTarget.EvaluateTargetHealth,
51-
HostedZoneId: domain.AliasTarget.HostedZoneId,
52-
}
52+
DNSName: properties.AliasTarget.DNSName,
53+
EvaluateTargetHealth: properties.AliasTarget.EvaluateTargetHealth,
54+
HostedZoneId: properties.AliasTarget.HostedZoneId,
55+
}
5356
: undefined,
54-
SetIdentifier: domain?.SetIdentifier,
55-
Weight: domain?.Weight,
56-
Region: domain?.Region,
57-
GeoLocation: domain?.GeoLocation,
58-
Failover: domain?.Failover,
59-
MultiValueAnswer: domain?.MultiValueAnswer,
60-
HealthCheckId: domain?.HealthCheckId,
57+
SetIdentifier: properties?.SetIdentifier,
58+
Weight: properties?.Weight,
59+
Region: properties?.Region,
60+
GeoLocation: properties?.GeoLocation,
61+
Failover: properties?.Failover,
62+
MultiValueAnswer: properties?.MultiValueAnswer,
63+
HealthCheckId: properties?.HealthCheckId,
6164
},
6265
},
6366
],
@@ -76,8 +79,7 @@ async function main(component: Input): Promise<Output> {
7679
console.error(child.stderr);
7780
return {
7881
status: "error",
79-
message:
80-
`Unable to create; AWS CLI exited with non zero code: ${child.exitCode}`,
82+
message: `Unable to create; AWS CLI exited with non zero code: ${child.exitCode}`,
8183
};
8284
}
8385

‎bin/clover/src/pipelines/aws/funcs/overrides/AWS::Route53::RecordSet/actions/refresh.ts‎

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
async function main(component: Input): Promise<Output> {
2-
const domain = component.properties?.domain;
3-
const hostedZoneId = domain?.HostedZoneId;
4-
const name = domain?.Name;
5-
const type = domain?.Type;
2+
// Changed: access via domain.properties
3+
const properties = component.properties?.domain?.properties;
4+
const hostedZoneId = properties?.HostedZoneId;
5+
const name = properties?.Name;
6+
const type = properties?.Type;
67

78
if (!hostedZoneId) {
89
return {
@@ -54,20 +55,23 @@ async function main(component: Input): Promise<Output> {
5455

5556
const recordSet = recordSets[0];
5657

58+
// Changed: nest payload under properties
5759
const payload = {
58-
Name: recordSet.Name,
59-
Type: recordSet.Type,
60-
TTL: recordSet.TTL,
61-
ResourceRecords: recordSet.ResourceRecords?.map((rr: any) => rr.Value),
62-
AliasTarget: recordSet.AliasTarget,
63-
SetIdentifier: recordSet.SetIdentifier,
64-
Weight: recordSet.Weight,
65-
Region: recordSet.Region,
66-
GeoLocation: recordSet.GeoLocation,
67-
Failover: recordSet.Failover,
68-
MultiValueAnswer: recordSet.MultiValueAnswer,
69-
HealthCheckId: recordSet.HealthCheckId,
70-
HostedZoneId: hostedZoneId,
60+
properties: {
61+
Name: recordSet.Name,
62+
Type: recordSet.Type,
63+
TTL: recordSet.TTL,
64+
ResourceRecords: recordSet.ResourceRecords?.map((rr: any) => rr.Value),
65+
AliasTarget: recordSet.AliasTarget,
66+
SetIdentifier: recordSet.SetIdentifier,
67+
Weight: recordSet.Weight,
68+
Region: recordSet.Region,
69+
GeoLocation: recordSet.GeoLocation,
70+
Failover: recordSet.Failover,
71+
MultiValueAnswer: recordSet.MultiValueAnswer,
72+
HealthCheckId: recordSet.HealthCheckId,
73+
HostedZoneId: hostedZoneId,
74+
},
7175
};
7276

7377
return {

‎bin/clover/src/pipelines/aws/funcs/overrides/AWS::Route53::RecordSet/management/discover.ts‎

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
async function main({
22
thisComponent,
33
}: Input): Promise<Output> {
4-
const domain = thisComponent.properties.domain;
4+
// Changed: access via domain.properties
5+
const properties = thisComponent.properties.domain.properties;
56
const region = _.get(thisComponent, [
67
"properties",
78
"domain",
@@ -11,16 +12,16 @@ async function main({
1112

1213
console.log("=== ROUTE53 DISCOVER RECORD SETS ===");
1314
console.log("Starting Route53 record discovery");
14-
console.log("Domain attributes:", JSON.stringify(domain, null, 2));
15+
console.log("Domain properties:", JSON.stringify(properties, null, 2));
1516
console.log("Region:", region);
1617

1718
if (!region) {
1819
throw new Error("Region is required for AWS CLI operations");
1920
}
2021

2122
// Get hosted zone ID - either directly or by looking up the name
22-
let hostedZoneId = domain.HostedZoneId;
23-
const hostedZoneName = domain.HostedZoneName;
23+
let hostedZoneId = properties?.HostedZoneId;
24+
const hostedZoneName = properties?.HostedZoneName;
2425

2526
// If we don't have a hosted zone ID but have a name, look it up
2627
if (!hostedZoneId && hostedZoneName) {
@@ -94,7 +95,7 @@ async function main({
9495
const baseName = record.Name.replace(/\.$/, "").replace(/\./g, "-");
9596
const componentName = `${baseName}-${record.Type}`;
9697

97-
// Build the domain properties
98+
// Changed: nest domainProps under properties
9899
const domainProps: any = {
99100
Name: record.Name,
100101
Type: record.Type,
@@ -156,14 +157,16 @@ async function main({
156157
domainProps.GeoProximityLocation = record.GeoProximityLocation;
157158
}
158159

159-
// Build the component spec
160+
// Build the component spec with nested properties
160161
specs[componentName] = {
161162
kind: "AWS::Route53::RecordSet",
162163
properties: {
163164
si: {
164165
name: componentName,
165166
},
166-
domain: domainProps,
167+
domain: {
168+
properties: domainProps,
169+
},
167170
resource: record,
168171
},
169172
attributes: {

‎bin/clover/src/pipelines/aws/funcs/overrides/AWS::Route53::RecordSet/management/import.ts‎

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
async function main({
22
thisComponent,
33
}: Input): Promise<Output> {
4-
const domain = thisComponent.properties.domain;
4+
// Changed: access via domain.properties
5+
const properties = thisComponent.properties.domain.properties;
56
const region = _.get(thisComponent, [
67
"properties",
78
"domain",
@@ -13,7 +14,7 @@ async function main({
1314
console.log("=== ROUTE53 IMPORT WITH 'ops' KEY ===");
1415
console.log(
1516
"Starting Route53 record import for:",
16-
JSON.stringify(domain, null, 2),
17+
JSON.stringify(properties, null, 2),
1718
);
1819
console.log("Resource ID:", resourceId);
1920
console.log("Region:", region);
@@ -113,13 +114,16 @@ async function main({
113114

114115
console.log("Found target record:", JSON.stringify(targetRecord, null, 2));
115116

116-
// Build the domain properties object
117+
// Changed: nest domainProps under properties
117118
const domainProps = {
118-
Name: targetRecord.Name,
119-
Type: targetRecord.Type,
120-
HostedZoneId: hostedZoneId,
121-
TTL: targetRecord.TTL?.toString(),
122-
ResourceRecords: targetRecord.ResourceRecords?.map((rr) => rr.Value) || [],
119+
properties: {
120+
Name: targetRecord.Name,
121+
Type: targetRecord.Type,
122+
HostedZoneId: hostedZoneId,
123+
TTL: targetRecord.TTL?.toString(),
124+
ResourceRecords:
125+
targetRecord.ResourceRecords?.map((rr) => rr.Value) || [],
126+
},
123127
};
124128

125129
console.log("Built domain properties:", JSON.stringify(domainProps, null, 2));

0 commit comments

Comments
 (0)