limgen
Version:
Infrastructure as Code generator
78 lines (77 loc) • 3.09 kB
JavaScript
;
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LoadBalancerAlbPublic = void 0;
const pulumi = __importStar(require("@pulumi/pulumi"));
const awsx = __importStar(require("@pulumi/awsx"));
const prefixed_1 = require("../utils/prefixed");
const deep_merge_1 = require("../utils/deep-merge");
class LoadBalancerAlbPublic extends pulumi.ComponentResource {
constructor(name = 'LoadBalancer', args, opts) {
super("limgen:LoadBalancerAlbPublic", name, {}, opts);
this._args = args;
this.lb = new awsx.lb.ApplicationLoadBalancer("LoadBalancer", (0, deep_merge_1.deepMerge)({
name: (0, prefixed_1.prefixed)("lb", 24),
defaultSecurityGroup: {
args: {
name: (0, prefixed_1.prefixed)("sg-lb", 32),
vpcId: this._args.vpc.vpc.id,
ingress: [
{
protocol: "tcp",
fromPort: 80,
toPort: 80,
cidrBlocks: ["0.0.0.0/0"],
}
],
egress: [
{
protocol: "tcp",
fromPort: 0,
toPort: 65535,
cidrBlocks: ["0.0.0.0/0"],
}
],
}
},
subnetIds: this._args.vpc.publicSubnetIds,
defaultTargetGroup: {
vpcId: this._args.vpc.vpcId,
name: (0, prefixed_1.prefixed)("tg", 32),
port: 3000,
targetType: "ip",
deregistrationDelay: 10,
healthCheck: {
enabled: true,
}
},
listener: {
port: 80,
},
}, this._args.albConfig));
this.registerOutputs({});
}
}
exports.LoadBalancerAlbPublic = LoadBalancerAlbPublic;