little-cartoon-10569
05/13/2021, 1:59 AMUncaught Error: unknown resource urn:pulumi:stack::project::aws:lambda/function:Function$aws:cloudwatch:EventRuleEventSubscription::filtering-ec2-start
at MockMonitor.registerResourceOutputs (node_modules/@pulumi/pulumi/runtime/mocks.js:125:23)
at /pulumi/projects/node_modules/@pulumi/pulumi/runtime/resource.js:615:91
at new Promise (<anonymous>)
at Object.<anonymous> (node_modules/@pulumi/pulumi/runtime/resource.js:615:50)
at Generator.next (<anonymous>)
at fulfilled (node_modules/@pulumi/pulumi/runtime/resource.js:18:58)
const role = new aws.iam.Role( ... );
const policy = new aws.iam.Policy( ... );
new aws.iam.RolePolicyAttachment( ... );
const rule = new aws.cloudwatch.EventRule( ... );
const handler = new aws.lambda.CallbackFunction<aws.cloudwatch.EventRuleEvent, void>(name,
role: role,
callback: async (_: aws.cloudwatch.EventRuleEvent) => {
...
}
}, opts);
const subscription = new aws.cloudwatch.EventRuleEventSubscription(name, rule, handler, {}, otherOpts);
function (args: pulumi.runtime.MockResourceArgs): { id: string, state: Record<string, any> } {
let state = {
...args.inputs,
id: `${args.inputs.name ?? args.name}_id`,
name: args.inputs.name ?? args.name,
};
return {
id: state.id,
state: state,
};
}
this.resources.get(req.getUrn())
return a falsey value?req.getUrn()
doesn't match the logic used to compose the urn in the resource constructor?newUrn
, and resource.js has createUrn
.urn:pulumi.stack::project::aws:cloudwatch/eventRule:EventRule$aws:lambda/function:Function$aws:cloudwatch:EventRuleEventSubscription::filtering-ec2-start
It looks like createUrn matches what I see in my real stack.
So maybe there's a bug in mocks.ts#newUrn, on this line: const parentType = qualifiedType.split("$").pop();
That seems to preclude the possibility of having a parent graph depth greater than 2....utils.withAlias()
. The resource-faking code can't handle aliases...