Skip to content

Commit 9e228d5

Browse files
committed
Remove unnecessary apply() wrapper in security group creation
1 parent 60be032 commit 9e228d5

File tree

1 file changed

+24
-30
lines changed

1 file changed

+24
-30
lines changed

src/v2/components/ecs-service/index.ts

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -424,41 +424,35 @@ export class EcsService extends pulumi.ComponentResource {
424424
);
425425
}
426426

427-
public addSecurityGroup(
428-
securityGroup: pulumi.Output<aws.ec2.SecurityGroup>,
429-
): void {
430-
this.securityGroups.push(securityGroup);
427+
public addSecurityGroup(securityGroup: aws.ec2.SecurityGroup): void {
428+
this.securityGroups.push(pulumi.output(securityGroup));
431429
}
432430

433431
private createDefaultSecurityGroup(): void {
434-
const securityGroup = pulumi
435-
.all([this.vpc, this.vpc.vpcId, this.vpc.vpc.cidrBlock])
436-
.apply(([vpc, vpcId, cidrBlock]) => {
437-
return new aws.ec2.SecurityGroup(
438-
`${this.name}-service-security-group`,
432+
const securityGroup = new aws.ec2.SecurityGroup(
433+
`${this.name}-service-security-group`,
434+
{
435+
vpcId: this.vpc.vpcId,
436+
ingress: [
439437
{
440-
vpcId,
441-
ingress: [
442-
{
443-
fromPort: 0,
444-
toPort: 0,
445-
protocol: '-1',
446-
cidrBlocks: [cidrBlock],
447-
},
448-
],
449-
egress: [
450-
{
451-
fromPort: 0,
452-
toPort: 0,
453-
protocol: '-1',
454-
cidrBlocks: ['0.0.0.0/0'],
455-
},
456-
],
457-
tags: commonTags,
438+
fromPort: 0,
439+
toPort: 0,
440+
protocol: '-1',
441+
cidrBlocks: [this.vpc.vpc.cidrBlock],
458442
},
459-
{ parent: this },
460-
);
461-
});
443+
],
444+
egress: [
445+
{
446+
fromPort: 0,
447+
toPort: 0,
448+
protocol: '-1',
449+
cidrBlocks: ['0.0.0.0/0'],
450+
},
451+
],
452+
tags: commonTags,
453+
},
454+
{ parent: this },
455+
);
462456
this.addSecurityGroup(securityGroup);
463457
}
464458

0 commit comments

Comments
 (0)