Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions bin/clover/src/pipelines/aws/funcs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,25 @@ export const CODE_GENERATION_FUNC_SPECS = {
},
} as const satisfies Record<string, FuncSpecInfo>;

// CF-only specific funcs - NOT included in provider-wide specs
// These are only added to CF-only assets in pruneCfAssets.ts
export const CF_ONLY_FUNC_SPECS = {
awsCfOnlyCodeGen: {
id: "f66e1afc8ff0f43f3b8a15c87f0a916243904de894e33322beb7f84dc792305a",
backendKind: "jsAttribute",
responseType: "codeGeneration",
displayName: "Code Gen for CloudFormation-only assets",
path: "./src/pipelines/aws/funcs/code-gen/awsCfOnlyCodeGen.ts",
},
awsCfOnlyLint: {
id: "dba872348ce39bfa8c15002037263b2528d81833c6c1f24fef5c9bc4115145b4",
backendKind: "jsAttribute",
responseType: "qualification",
displayName: "CloudFormation Lint Validation",
path: "./src/pipelines/aws/funcs/qualifications/awsCfOnlyLint.ts",
},
} as const satisfies Record<string, FuncSpecInfo>;

Comment on lines +69 to +87
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's weird to me that these are here but the attribute func is in the other file. They should all be in the same place, here or there.

export const MANAGEMENT_FUNCS = {
// Management
"Discover on AWS": {
Expand Down
12 changes: 12 additions & 0 deletions bin/clover/src/pipelines/aws/funcs/attribute/awsCfOnlyAttr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
async function main({
properties,
extra
}: Input): Promise<Output> {
if (!properties) {
return null;
}
return JSON.stringify({
Type: extra?.AwsResourceType,
Properties: properties
}, null, 2);
}

This file was deleted.

32 changes: 32 additions & 0 deletions bin/clover/src/pipelines/aws/funcs/code-gen/awsCfOnlyCodeGen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
async function main(component: Input): Promise<Output> {
const resourceBody = component.domain?.CloudFormationResourceBody;

if (!resourceBody) {
return {
format: "json",
code: JSON.stringify(
{
AWSTemplateFormatVersion: "2010-09-09",
Resources: {},
},
null,
2,
),
};
}

// CloudFormationResourceBody is already a JSON string from the attribute function
const resource = JSON.parse(resourceBody);

const cloudFormationTemplate = {
AWSTemplateFormatVersion: "2010-09-09",
Resources: {
cfnResource: resource,
},
};

return {
format: "json",
code: JSON.stringify(cloudFormationTemplate, null, 2),
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ async function main(component: Input): Promise<Output> {
};
}

const domain = component.properties?.domain;
const hostedZoneId = domain?.HostedZoneId;
const name = domain?.Name;
const type = domain?.Type;
// Changed: access via domain.properties
const properties = component.properties?.domain?.properties;
const hostedZoneId = properties?.HostedZoneId;
const name = properties?.Name;
const type = properties?.Type;

if (!hostedZoneId) {
return {
Expand Down Expand Up @@ -40,24 +41,26 @@ async function main(component: Input): Promise<Output> {
ResourceRecordSet: {
Name: name,
Type: type,
TTL: domain?.TTL ? parseInt(domain.TTL) : undefined,
ResourceRecords: domain?.ResourceRecords?.map((record: string) => ({
Value: record,
})),
AliasTarget: domain?.AliasTarget
TTL: properties?.TTL ? parseInt(properties.TTL) : undefined,
ResourceRecords: properties?.ResourceRecords?.map(
(record: string) => ({
Value: record,
}),
),
AliasTarget: properties?.AliasTarget
? {
DNSName: domain.AliasTarget.DNSName,
EvaluateTargetHealth: domain.AliasTarget.EvaluateTargetHealth,
HostedZoneId: domain.AliasTarget.HostedZoneId,
}
DNSName: properties.AliasTarget.DNSName,
EvaluateTargetHealth: properties.AliasTarget.EvaluateTargetHealth,
HostedZoneId: properties.AliasTarget.HostedZoneId,
}
: undefined,
SetIdentifier: domain?.SetIdentifier,
Weight: domain?.Weight,
Region: domain?.Region,
GeoLocation: domain?.GeoLocation,
Failover: domain?.Failover,
MultiValueAnswer: domain?.MultiValueAnswer,
HealthCheckId: domain?.HealthCheckId,
SetIdentifier: properties?.SetIdentifier,
Weight: properties?.Weight,
Region: properties?.Region,
GeoLocation: properties?.GeoLocation,
Failover: properties?.Failover,
MultiValueAnswer: properties?.MultiValueAnswer,
HealthCheckId: properties?.HealthCheckId,
},
},
],
Expand All @@ -76,8 +79,7 @@ async function main(component: Input): Promise<Output> {
console.error(child.stderr);
return {
status: "error",
message:
`Unable to create; AWS CLI exited with non zero code: ${child.exitCode}`,
message: `Unable to create; AWS CLI exited with non zero code: ${child.exitCode}`,
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
async function main(component: Input): Promise<Output> {
const domain = component.properties?.domain;
const hostedZoneId = domain?.HostedZoneId;
const name = domain?.Name;
const type = domain?.Type;
// Changed: access via domain.properties
const properties = component.properties?.domain?.properties;
const hostedZoneId = properties?.HostedZoneId;
const name = properties?.Name;
const type = properties?.Type;

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

const recordSet = recordSets[0];

// Changed: nest payload under properties
const payload = {
Name: recordSet.Name,
Type: recordSet.Type,
TTL: recordSet.TTL,
ResourceRecords: recordSet.ResourceRecords?.map((rr: any) => rr.Value),
AliasTarget: recordSet.AliasTarget,
SetIdentifier: recordSet.SetIdentifier,
Weight: recordSet.Weight,
Region: recordSet.Region,
GeoLocation: recordSet.GeoLocation,
Failover: recordSet.Failover,
MultiValueAnswer: recordSet.MultiValueAnswer,
HealthCheckId: recordSet.HealthCheckId,
HostedZoneId: hostedZoneId,
properties: {
Name: recordSet.Name,
Type: recordSet.Type,
TTL: recordSet.TTL,
ResourceRecords: recordSet.ResourceRecords?.map((rr: any) => rr.Value),
AliasTarget: recordSet.AliasTarget,
SetIdentifier: recordSet.SetIdentifier,
Weight: recordSet.Weight,
Region: recordSet.Region,
GeoLocation: recordSet.GeoLocation,
Failover: recordSet.Failover,
MultiValueAnswer: recordSet.MultiValueAnswer,
HealthCheckId: recordSet.HealthCheckId,
HostedZoneId: hostedZoneId,
},
};

return {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
async function main({
thisComponent,
}: Input): Promise<Output> {
const domain = thisComponent.properties.domain;
// Changed: access via domain.properties
const properties = thisComponent.properties.domain.properties;
const region = _.get(thisComponent, [
"properties",
"domain",
Expand All @@ -11,16 +12,16 @@ async function main({

console.log("=== ROUTE53 DISCOVER RECORD SETS ===");
console.log("Starting Route53 record discovery");
console.log("Domain attributes:", JSON.stringify(domain, null, 2));
console.log("Domain properties:", JSON.stringify(properties, null, 2));
console.log("Region:", region);

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

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

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

// Build the domain properties
// Changed: nest domainProps under properties
const domainProps: any = {
Name: record.Name,
Type: record.Type,
Expand Down Expand Up @@ -156,14 +157,16 @@ async function main({
domainProps.GeoProximityLocation = record.GeoProximityLocation;
}

// Build the component spec
// Build the component spec with nested properties
specs[componentName] = {
kind: "AWS::Route53::RecordSet",
properties: {
si: {
name: componentName,
},
domain: domainProps,
domain: {
properties: domainProps,
},
resource: record,
},
attributes: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
async function main({
thisComponent,
}: Input): Promise<Output> {
const domain = thisComponent.properties.domain;
// Changed: access via domain.properties
const properties = thisComponent.properties.domain.properties;
const region = _.get(thisComponent, [
"properties",
"domain",
Expand All @@ -13,7 +14,7 @@ async function main({
console.log("=== ROUTE53 IMPORT WITH 'ops' KEY ===");
console.log(
"Starting Route53 record import for:",
JSON.stringify(domain, null, 2),
JSON.stringify(properties, null, 2),
);
console.log("Resource ID:", resourceId);
console.log("Region:", region);
Expand Down Expand Up @@ -113,13 +114,16 @@ async function main({

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

// Build the domain properties object
// Changed: nest domainProps under properties
const domainProps = {
Name: targetRecord.Name,
Type: targetRecord.Type,
HostedZoneId: hostedZoneId,
TTL: targetRecord.TTL?.toString(),
ResourceRecords: targetRecord.ResourceRecords?.map((rr) => rr.Value) || [],
properties: {
Name: targetRecord.Name,
Type: targetRecord.Type,
HostedZoneId: hostedZoneId,
TTL: targetRecord.TTL?.toString(),
ResourceRecords:
targetRecord.ResourceRecords?.map((rr) => rr.Value) || [],
},
};

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