crooked-dawn-93088
01/04/2022, 2:07 PMget
to import the default security group for further reference:
import * as aws from '@pulumi/aws';
import * as awsx from '@pulumi/awsx';
export const vpc = new awsx.ec2.Vpc('mdm-db-vpc', {
subnets: [{ type: 'isolated' }],
});
export const securityGroup = aws.ec2.SecurityGroup.get(
'default',
vpc.vpc.defaultSecurityGroupId,
);
little-cartoon-10569
01/04/2022, 8:07 PMsetMock
function takes an object that must have a call
function. This function is where you fake out calls to Pulumi functions.aws.ec2.getAmi()
function being faked here: https://github.com/pulumi/examples/blob/947273e7a62cf31649559344b2dd8df78bddacd9/testing-unit-ts/mocha/ec2tests.ts#L44crooked-dawn-93088
01/05/2022, 7:51 PMcall
function of the mocks. I logged args.token
of all invokations to the console and none of them where matching but I still had this error message.
[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "Error: failed to read resource #undefined 'default' [aws:ec2/securityGroup:SecurityGroup]: req.getCustom is not a function".] {
code: 'ERR_UNHANDLED_REJECTION'
}
Anyway I considered that I do not need to export the whole securityGroup
just the securityGroupId
that I already got from the VPC so problem solved. 🙂