Skip to content

Commit

Permalink
Fix AWS provider having invalid names
Browse files Browse the repository at this point in the history
  • Loading branch information
fwang committed Jan 5, 2024
1 parent 4c5986f commit 0937789
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions internal/components/src/auto/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ export async function run(program: PulumiFn) {
};
}
return undefined;
},
}
);
runtime.registerStackTransformation(
(args: util.ResourceTransformationArgs) => {
let normalizedName = args.name;
if (args.type === "pulumi-nodejs:dynamic:Resource") {
if (
args.type === "pulumi-nodejs:dynamic:Resource" ||
args.type === "pulumi:providers:aws"
) {
const parts = args.name.split(".");
if (parts.length === 3 && parts[1] === "sst") {
normalizedName = parts[0];
Expand All @@ -34,12 +37,12 @@ export async function run(program: PulumiFn) {

if (!normalizedName.match(/^[A-Z][a-zA-Z0-9]*$/)) {
throw new Error(
`Invalid component name "${normalizedName}". Component names must start with an uppercase letter and contain only alphanumeric characters.`,
`Invalid component name "${normalizedName}". Component names must start with an uppercase letter and contain only alphanumeric characters.`
);
}

return undefined;
},
}
);

const results = await program();
Expand Down

0 comments on commit 0937789

Please sign in to comment.