UNPKG

@studion/infra-code-blocks

Version:
36 lines (35 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Vpc = void 0; const pulumi = require("@pulumi/pulumi"); const awsx = require("@pulumi/awsx"); const common_tags_1 = require("../../shared/common-tags"); const types_1 = require("@pulumi/awsx/types"); const merge_with_defaults_1 = require("../../shared/merge-with-defaults"); const defaults = { numberOfAvailabilityZones: 2, }; class Vpc extends pulumi.ComponentResource { vpc; constructor(name, args = {}, opts = {}) { super('studion:vpc:Vpc', name, {}, opts); const argsWithDefaults = (0, merge_with_defaults_1.mergeWithDefaults)(defaults, args); this.vpc = new awsx.ec2.Vpc(`${name}-vpc`, { numberOfAvailabilityZones: argsWithDefaults.numberOfAvailabilityZones, enableDnsHostnames: true, enableDnsSupport: true, subnetStrategy: types_1.enums.ec2.SubnetAllocationStrategy.Auto, // Switching from `Legacy` to `Auto` strategy changed ordering of the specs // `Auto` is using the provided ordering, while `Legacy` enforced `Private`, `Public`, `Isolated` ordering // Applying ordering to match one from `Legacy` to avoid breaking changes subnetSpecs: [ { type: awsx.ec2.SubnetType.Private, cidrMask: 24 }, { type: awsx.ec2.SubnetType.Public, cidrMask: 24 }, { type: awsx.ec2.SubnetType.Isolated, cidrMask: 24 }, ], tags: { ...common_tags_1.commonTags, ...argsWithDefaults.tags }, }, { parent: this }); this.registerOutputs(); } } exports.Vpc = Vpc;