Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
node-version: 24
- name: Install dependencies
run: npm ci
- name: Build dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: "Setup node"
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
- name: "Install dependencies"
run: |
npm ci
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20
24
24 changes: 17 additions & 7 deletions dist/acm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Certificate = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
Expand Down
24 changes: 17 additions & 7 deletions dist/build-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.BuildPipeline = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
Expand Down
9 changes: 9 additions & 0 deletions dist/cloudflare-ips.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* Cloudflare published edge ranges.
* https://www.cloudflare.com/ips-v4
* https://www.cloudflare.com/ips-v6
* Retrieved 2026-10-28.
*/
export declare const CLOUDFLARE_IPV4_CIDRS: string[];
export declare const CLOUDFLARE_IPV6_CIDRS: string[];
export declare const CLOUDFLARE_CIDRS: string[];
39 changes: 39 additions & 0 deletions dist/cloudflare-ips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.CLOUDFLARE_CIDRS = exports.CLOUDFLARE_IPV6_CIDRS = exports.CLOUDFLARE_IPV4_CIDRS = void 0;
/**
* Cloudflare published edge ranges.
* https://www.cloudflare.com/ips-v4
* https://www.cloudflare.com/ips-v6
* Retrieved 2026-10-28.
*/
exports.CLOUDFLARE_IPV4_CIDRS = [
'173.245.48.0/20',
'103.21.244.0/22',
'103.22.200.0/22',
'103.31.4.0/22',
'141.101.64.0/18',
'108.162.192.0/18',
'190.93.240.0/20',
'188.114.96.0/20',
'197.234.240.0/22',
'198.41.128.0/17',
'162.158.0.0/15',
'104.16.0.0/13',
'104.24.0.0/14',
'172.64.0.0/13',
'131.0.72.0/22',
];
exports.CLOUDFLARE_IPV6_CIDRS = [
'2400:cb00::/32',
'2606:4700::/32',
'2803:f800::/32',
'2405:b500::/32',
'2405:8100::/32',
'2a06:98c0::/29',
'2c0f:f248::/32',
];
exports.CLOUDFLARE_CIDRS = [
...exports.CLOUDFLARE_IPV4_CIDRS,
...exports.CLOUDFLARE_IPV6_CIDRS,
];
24 changes: 17 additions & 7 deletions dist/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stage = exports.StackConfig = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
Expand Down
24 changes: 17 additions & 7 deletions dist/ecr-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.EcrRepositoryStack = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
Expand Down
14 changes: 13 additions & 1 deletion dist/fargate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import * as ecr from 'aws-cdk-lib/aws-ecr';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as route53 from 'aws-cdk-lib/aws-route53';
import { StackConfig } from './configuration';
import { LOAD_BALANCER_INGRESS, type LoadBalancerIngress } from './load-balancer-ingress';
export { LOAD_BALANCER_INGRESS, type LoadBalancerIngress };
/**
* Represents a definition for a task that can be used to generate a task definition
*/
Expand Down Expand Up @@ -38,6 +40,17 @@ interface FargateServiceProps extends cdk.NestedStackProps {
zone: route53.IHostedZone;
repository: ecr.IRepository;
taskConfiguration: TaskConfiguration;
/**
* Who can connect to the load balancer on ports 80 and 443.
* @default LOAD_BALANCER_INGRESS.Open
*/
loadBalancerIngress?: LoadBalancerIngress;
/**
* CIDRs allowed to reach the load balancer. Required when
* `loadBalancerIngress` is `LOAD_BALANCER_INGRESS.Cidr`. Bare IPv4
* addresses are treated as /32 and bare IPv6 addresses as /128.
*/
loadBalancerCidrs?: string[];
}
/**
* Generate a fargate service that can be attached to a cluster. This service will include its own
Expand All @@ -47,4 +60,3 @@ export declare class FargateService extends cdk.NestedStack {
readonly service: ecs_patterns.ApplicationLoadBalancedFargateService;
constructor(scope: Construct, id: string, props: FargateServiceProps);
}
export {};
38 changes: 29 additions & 9 deletions dist/fargate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.FargateService = void 0;
exports.FargateService = exports.LOAD_BALANCER_INGRESS = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
const ecs = __importStar(require("aws-cdk-lib/aws-ecs"));
const ecs_patterns = __importStar(require("aws-cdk-lib/aws-ecs-patterns"));
Expand All @@ -32,6 +42,8 @@ const ec2 = __importStar(require("aws-cdk-lib/aws-ec2"));
const iam = __importStar(require("aws-cdk-lib/aws-iam"));
const route53 = __importStar(require("aws-cdk-lib/aws-route53"));
const targets = __importStar(require("aws-cdk-lib/aws-route53-targets"));
const load_balancer_ingress_1 = require("./load-balancer-ingress");
Object.defineProperty(exports, "LOAD_BALANCER_INGRESS", { enumerable: true, get: function () { return load_balancer_ingress_1.LOAD_BALANCER_INGRESS; } });
const route53_1 = require("./route53");
// Default docker image to use
const DEFAULT_IMAGE = 'nginxdemos/hello:latest';
Expand All @@ -43,7 +55,8 @@ const DEFAULT_VERSION = 'default';
class FargateService extends cdk.NestedStack {
constructor(scope, id, props) {
super(scope, id, props);
const { healthCheckPath = '/health-check', imageVersion = DEFAULT_VERSION, subDomainIncludingDot = '', stack, cluster, certificate, zone, repository, taskConfiguration, } = props;
const { healthCheckPath = '/health-check', imageVersion = DEFAULT_VERSION, subDomainIncludingDot = '', stack, cluster, certificate, zone, repository, taskConfiguration, loadBalancerIngress = load_balancer_ingress_1.LOAD_BALANCER_INGRESS.Open, loadBalancerCidrs, } = props;
const allowedCidrs = (0, load_balancer_ingress_1.resolveLoadBalancerCidrs)(loadBalancerIngress, loadBalancerCidrs);
// Compile secrets into list of mapped ecs.Secrets
const secrets = {};
const secretValues = taskConfiguration.secrets;
Expand Down Expand Up @@ -80,7 +93,14 @@ class FargateService extends cdk.NestedStack {
subnetType: ec2.SubnetType.PUBLIC,
onePerAz: true,
},
// Closed listeners get explicit CIDR rules below. Leave this unset for
// the default so the pattern keeps opening 80 and 443 to the internet.
openListener: allowedCidrs ? false : undefined,
});
if (allowedCidrs) {
// This service always terminates HTTPS and redirects HTTP.
(0, load_balancer_ingress_1.restrictLoadBalancerIngress)(this, this.service.loadBalancer, cluster.vpc, allowedCidrs, [80, 443]);
}
// Setup AutoScaling policy
if (taskConfiguration.autoScalingCpuTarget) {
// Default max capacity to double desired unless specified
Expand Down
24 changes: 17 additions & 7 deletions dist/github.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.GithubDeployStack = void 0;
const cdk = __importStar(require("aws-cdk-lib"));
Expand Down
24 changes: 17 additions & 7 deletions dist/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
}) : 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;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.hydrateRawSecret = exports.hydrateSecret = exports.generateSecretManager = exports.getCredentials = exports.loadJsonFile = void 0;
const client_secrets_manager_1 = require("@aws-sdk/client-secrets-manager");
Expand Down
1 change: 1 addition & 0 deletions dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './acm';
export * from './build-pipeline';
export * from './cloudflare-ips';
export * from './configuration';
export * from './ecr-repository';
export * from './fargate';
Expand Down
1 change: 1 addition & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./acm"), exports);
__exportStar(require("./build-pipeline"), exports);
__exportStar(require("./cloudflare-ips"), exports);
__exportStar(require("./configuration"), exports);
__exportStar(require("./ecr-repository"), exports);
__exportStar(require("./fargate"), exports);
Expand Down
25 changes: 25 additions & 0 deletions dist/load-balancer-ingress.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { Construct } from 'constructs';
import * as ec2 from 'aws-cdk-lib/aws-ec2';
import * as elb from 'aws-cdk-lib/aws-elasticloadbalancingv2';
/**
* Who may connect to the load balancer listeners (HTTP 80 and HTTPS 443).
*
* - `Open`: no IP restriction. This is the default and matches previous behaviour.
* - `Cloudflare`: only Cloudflare's published IPv4 and IPv6 ranges.
* - `Cidr`: only the ranges passed in `loadBalancerCidrs`.
*/
export declare const LOAD_BALANCER_INGRESS: {
readonly Open: "open";
readonly Cloudflare: "cloudflare";
readonly Cidr: "cidr";
};
export type LoadBalancerIngress = (typeof LOAD_BALANCER_INGRESS)[keyof typeof LOAD_BALANCER_INGRESS];
export declare function resolveLoadBalancerCidrs(ingress: LoadBalancerIngress, cidrs: string[] | undefined): string[] | undefined;
/**
* Allow `cidrs` to reach the load balancer on `ports`, and nothing else.
* The listeners must be created with `openListener: false` so the default
* 0.0.0.0/0 rule is not added.
*
* Rules are split across extra security groups when one group cannot hold them.
*/
export declare function restrictLoadBalancerIngress(scope: Construct, loadBalancer: elb.ApplicationLoadBalancer, vpc: ec2.IVpc, cidrs: string[], ports: number[]): void;
Loading
Loading