From 02f6a7d466679a6d06d307d05eeb5e469114ce4f Mon Sep 17 00:00:00 2001 From: seven Date: Thu, 2 Jan 2025 23:58:53 +0800 Subject: [PATCH] feat: enable support for aliyun RDS resources (#27) feat: enable support for aliyun RDS resources Refs: #26 --------- Signed-off-by: seven --- package-lock.json | 206 ++++------------- package.json | 1 + samples/aliyun-poc-es.yml | 30 +++ samples/aliyun-poc-fc.yml | 60 +++++ samples/aliyun-poc-rds.yml | 24 ++ samples/huawei-poc-fc.yml | 60 +++++ src/parser/databaseParser.ts | 20 +- src/stack/rosStack/database.ts | 283 ++++++++++++++++++++++- src/stack/rosStack/rosStack.ts | 0 src/types/domains/database.ts | 59 +++-- src/validator/databaseSchema.ts | 56 ++++- tests/fixtures/deployFixture.ts | 14 +- tests/fixtures/serverless-insight-es.yml | 12 +- tests/fixtures/serverless-insight.yml | 12 - tests/parser/parse.test.ts | 17 +- 15 files changed, 625 insertions(+), 229 deletions(-) create mode 100644 samples/aliyun-poc-es.yml create mode 100644 samples/aliyun-poc-fc.yml create mode 100644 samples/aliyun-poc-rds.yml create mode 100644 samples/huawei-poc-fc.yml delete mode 100644 src/stack/rosStack/rosStack.ts diff --git a/package-lock.json b/package-lock.json index 88d7309..4ae5b10 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "@alicloud/ros-cdk-oss": "^1.4.0", "@alicloud/ros-cdk-ossdeployment": "^1.4.0", "@alicloud/ros-cdk-ram": "^1.4.0", + "@alicloud/ros-cdk-rds": "^1.5.0", "@alicloud/ros-cdk-sls": "^1.5.0", "@alicloud/ros20190910": "^3.5.2", "ajv": "^8.17.1", @@ -140,14 +141,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-apigateway/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-assembly-schema": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-assembly-schema/-/ros-cdk-assembly-schema-1.4.0.tgz", @@ -237,14 +230,6 @@ "inBundle": true, "license": "MIT" }, - "node_modules/@alicloud/ros-cdk-core/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-core/node_modules/fs-extra": { "version": "9.1.0", "inBundle": true, @@ -341,14 +326,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-elasticsearchserverless/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-fc": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-fc/-/ros-cdk-fc-1.4.0.tgz", @@ -366,14 +343,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-fc/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-fc3": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-fc3/-/ros-cdk-fc3-1.4.0.tgz", @@ -387,14 +356,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-fc3/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-oss": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-oss/-/ros-cdk-oss-1.4.0.tgz", @@ -408,14 +369,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-oss/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-ossassets": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-ossassets/-/ros-cdk-ossassets-1.4.0.tgz", @@ -521,14 +474,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@alicloud/ros-cdk-ossassets/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-ossassets/node_modules/content-type": { "version": "1.0.5", "inBundle": true, @@ -1359,14 +1304,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/@alicloud/ros-cdk-ossdeployment/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-ossdeployment/node_modules/content-type": { "version": "1.0.5", "inBundle": true, @@ -2100,12 +2037,17 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-ram/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" + "node_modules/@alicloud/ros-cdk-rds": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-rds/-/ros-cdk-rds-1.5.0.tgz", + "integrity": "sha512-6up/JfZ1C0WpRzAcg2DqvQ1VZDwfoipvsPdGfBLCOEjac59rU2KwhdlUbALogiQ0hj8xqwU/od7hKbflYEj/dQ==", + "dependencies": { + "@alicloud/ros-cdk-core": "^1.0.27", + "constructs": "^3.0.4" + }, + "peerDependencies": { + "@alicloud/ros-cdk-core": "^1.0.27", + "constructs": "^3.0.4" } }, "node_modules/@alicloud/ros-cdk-ros": { @@ -2121,14 +2063,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-ros/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros-cdk-sls": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-sls/-/ros-cdk-sls-1.5.0.tgz", @@ -2142,14 +2076,6 @@ "constructs": "^3.0.4" } }, - "node_modules/@alicloud/ros-cdk-sls/node_modules/constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", - "engines": { - "node": ">= 16.14.0" - } - }, "node_modules/@alicloud/ros20190910": { "version": "3.5.2", "resolved": "https://registry.npmjs.org/@alicloud/ros20190910/-/ros20190910-3.5.2.tgz", @@ -4731,6 +4657,14 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "node_modules/constructs": { + "version": "3.4.344", + "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", + "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==", + "engines": { + "node": ">= 16.14.0" + } + }, "node_modules/content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -8945,13 +8879,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-assembly-schema": { @@ -9011,11 +8938,6 @@ "version": "0.0.1", "bundled": true }, - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - }, "fs-extra": { "version": "9.1.0", "bundled": true, @@ -9077,13 +8999,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-fc": { @@ -9095,13 +9010,6 @@ "@alicloud/ros-cdk-oss": "^1.0.25", "@alicloud/ros-cdk-ossassets": "^1.0.25", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-fc3": { @@ -9111,13 +9019,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-oss": { @@ -9127,13 +9028,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-ossassets": { @@ -9212,11 +9106,6 @@ "set-function-length": "^1.2.1" } }, - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - }, "content-type": { "version": "1.0.5", "bundled": true @@ -9766,11 +9655,6 @@ "set-function-length": "^1.2.1" } }, - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - }, "content-type": { "version": "1.0.5", "bundled": true @@ -10246,13 +10130,15 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } + } + }, + "@alicloud/ros-cdk-rds": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@alicloud/ros-cdk-rds/-/ros-cdk-rds-1.5.0.tgz", + "integrity": "sha512-6up/JfZ1C0WpRzAcg2DqvQ1VZDwfoipvsPdGfBLCOEjac59rU2KwhdlUbALogiQ0hj8xqwU/od7hKbflYEj/dQ==", + "requires": { + "@alicloud/ros-cdk-core": "^1.0.27", + "constructs": "^3.0.4" } }, "@alicloud/ros-cdk-ros": { @@ -10262,13 +10148,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros-cdk-sls": { @@ -10278,13 +10157,6 @@ "requires": { "@alicloud/ros-cdk-core": "^1.0.27", "constructs": "^3.0.4" - }, - "dependencies": { - "constructs": { - "version": "3.4.344", - "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", - "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" - } } }, "@alicloud/ros20190910": { @@ -11821,8 +11693,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} + "dev": true }, "acorn-walk": { "version": "8.3.2", @@ -12255,6 +12126,11 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, + "constructs": { + "version": "3.4.344", + "resolved": "https://registry.npmjs.org/constructs/-/constructs-3.4.344.tgz", + "integrity": "sha512-Qq3upn44oGdvgasHUKWVFsrynyYrtVRd9fd8ko9cJOrFzx9eCm3iI4bhBryQqaISdausbTYUOXmoEe/YSJ16Nw==" + }, "content-type": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", @@ -12337,8 +12213,7 @@ "version": "1.5.1", "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", - "dev": true, - "requires": {} + "dev": true }, "deep-is": { "version": "0.1.4", @@ -12569,8 +12444,7 @@ "version": "9.1.0", "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-9.1.0.tgz", "integrity": "sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==", - "dev": true, - "requires": {} + "dev": true }, "eslint-plugin-prettier": { "version": "5.2.1", @@ -13603,8 +13477,7 @@ "version": "1.2.3", "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", - "dev": true, - "requires": {} + "dev": true }, "jest-regex-util": { "version": "29.6.3", @@ -14991,8 +14864,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", - "dev": true, - "requires": {} + "dev": true }, "ts-jest": { "version": "29.2.5", diff --git a/package.json b/package.json index dda131f..fbf5e6f 100644 --- a/package.json +++ b/package.json @@ -58,6 +58,7 @@ "@alicloud/ros-cdk-oss": "^1.4.0", "@alicloud/ros-cdk-ossdeployment": "^1.4.0", "@alicloud/ros-cdk-ram": "^1.4.0", + "@alicloud/ros-cdk-rds": "^1.5.0", "@alicloud/ros-cdk-sls": "^1.5.0", "@alicloud/ros20190910": "^3.5.2", "ajv": "^8.17.1", diff --git a/samples/aliyun-poc-es.yml b/samples/aliyun-poc-es.yml new file mode 100644 index 0000000..da072a6 --- /dev/null +++ b/samples/aliyun-poc-es.yml @@ -0,0 +1,30 @@ +version: 0.0.1 + +provider: + name: aliyun + region: cn-chengdu + + +service: insight-db-poc + +tags: + owner: geek-fun + +databases: + # insight_es_db: + # name: insight-poc-es + # type: ELASTICSEARCH_SERVERLESS + # version: '7.10' + # engine_mode: SEARCH + # cu: 1 + # storage_size: 20 + # security: + # basic_auth: + # password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg' + insight_poc_db: + name: insight-poc-rds + type: RDS_PGSQL_SERVERLESS + version: PGSQL_16 + security: + basic_auth: + password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg' diff --git a/samples/aliyun-poc-fc.yml b/samples/aliyun-poc-fc.yml new file mode 100644 index 0000000..42d18a7 --- /dev/null +++ b/samples/aliyun-poc-fc.yml @@ -0,0 +1,60 @@ +version: 0.0.1 +provider: + name: aliyun + region: cn-chengdu + +vars: + region: cn-hangzhou + testv: testVarValue + handler: index.handler + +stages: + default: + region: ${vars.region} + node_env: default + dev: + region: ${vars.region} + node_env: development + prod: + region: cn-shanghai + +service: insight-poc + +tags: + owner: geek-fun + +functions: + insight_poc_fn: + name: insight-poc-fn + runtime: nodejs18 + handler: ${vars.handler} + code: tests/fixtures/artifacts/artifact.zip + memory: 512 + timeout: 10 + environment: + NODE_ENV: ${stages.node_env} + TEST_VAR: ${vars.testv} + TEST_VAR_EXTRA: abcds-${vars.testv}-andyou + +databases: + insight_poc_db: + name: insight-poc-db + type: RDS_POSTGRESQL_SERVERLESS + version: '17.0' + security: + basic_auth: + password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg' + +events: + gateway_event: + type: API_GATEWAY + name: insight-poc-gateway + triggers: + - method: GET + path: /api/hello + backend: ${functions.insight_poc_fn} +# custom_domain: +# domain_name: test.com +# certificate_name: test +# certificate_private_key: test +# certificate_body: test diff --git a/samples/aliyun-poc-rds.yml b/samples/aliyun-poc-rds.yml new file mode 100644 index 0000000..07019c1 --- /dev/null +++ b/samples/aliyun-poc-rds.yml @@ -0,0 +1,24 @@ +version: 0.0.1 + +provider: + name: aliyun + region: cn-chengdu + + +service: insight-rds-poc + +tags: + owner: geek-fun + +databases: + insight_poc_db: + name: insight-poc-rds + type: RDS_PGSQL_SERVERLESS + version: PGSQL_16 + security: + basic_auth: + master_user: 'db_root' + password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg' + network: + type: 'PRIVATE' + diff --git a/samples/huawei-poc-fc.yml b/samples/huawei-poc-fc.yml new file mode 100644 index 0000000..fc4c596 --- /dev/null +++ b/samples/huawei-poc-fc.yml @@ -0,0 +1,60 @@ +version: 0.0.1 +provider: + name: huawei + region: cn-north-4 + +vars: + testv: testVarValue + handler: index.handler + +stages: + default: + node_env: default + dev: + region: ${vars.region} + node_env: development + prod: + node_env: prod +service: insight-poc + +tags: + owner: geek-fun + +functions: + insight_poc_fn: + name: insight-poc-fn + runtime: nodejs18 + handler: ${vars.handler} + code: tests/fixtures/artifacts/artifact.zip + memory: 512 + timeout: 10 + environment: + NODE_ENV: ${stages.node_env} + TEST_VAR: ${vars.testv} + TEST_VAR_EXTRA: abcds-${vars.testv}-andyou + +#databases: +# insight_es_db: +# name: insight-poc-es +# type: ELASTICSEARCH_SERVERLESS +# version: 7.10 +# engine_mode: SEARCH +# security: +# basic_auth: +# password: 123456 +# cu: 1 +# storage_size: 20 + +events: + gateway_event: + type: API_GATEWAY + name: insight-poc-gateway + triggers: + - method: GET + path: /api/hello + backend: ${functions.insight_poc_fn} +# custom_domain: +# domain_name: test.com +# certificate_name: test +# certificate_private_key: test +# certificate_body: test diff --git a/src/parser/databaseParser.ts b/src/parser/databaseParser.ts index 6874a53..4345174 100644 --- a/src/parser/databaseParser.ts +++ b/src/parser/databaseParser.ts @@ -1,4 +1,4 @@ -import { DatabaseDomain, DatabaseEnum, DatabaseRaw } from '../types'; +import { DatabaseDomain, DatabaseEnum, DatabaseRaw, DatabaseVersionEnum } from '../types'; import { get, isEmpty } from 'lodash'; export const parseDatabase = (databases?: { @@ -11,17 +11,23 @@ export const parseDatabase = (databases?: { key: key, name: database.name, type: database.type as DatabaseEnum, - version: database.version, - engineMode: database.engine_mode, + version: database.version as DatabaseVersionEnum, security: { basicAuth: { + username: get(database, 'security.basic_auth.master_user'), password: get(database, 'security.basic_auth.password'), }, }, - cu: database.cu, - storageSize: database.storage_size, - network: database.network && { - public: database.network?.public as boolean, + cu: { + min: database.cu?.min ?? 0, + max: database.cu?.max ?? 6, + }, + storage: { + min: database.storage?.min ?? 20, + }, + network: { + type: database.network?.type ?? 'PRIVATE', + ingressRules: database.network?.ingress_rules ?? ['0.0.0.0/0'], }, })); }; diff --git a/src/stack/rosStack/database.ts b/src/stack/rosStack/database.ts index 84bb30f..8cb2297 100644 --- a/src/stack/rosStack/database.ts +++ b/src/stack/rosStack/database.ts @@ -1,9 +1,198 @@ import * as ros from '@alicloud/ros-cdk-core'; +import * as rds from '@alicloud/ros-cdk-rds'; import { replaceReference } from '../../common'; -import { ActionContext, DatabaseDomain, DatabaseEngineMode, DatabaseEnum } from '../../types'; +import { ActionContext, DatabaseDomain, DatabaseEnum, DatabaseVersionEnum } from '../../types'; import { isEmpty } from 'lodash'; import * as esServerless from '@alicloud/ros-cdk-elasticsearchserverless'; +const rdsEngineMap = new Map< + string, + { + engine: string; + version: string; + category: string; + dbInstanceClass: string; + quota: { minCapacity: number; maxCapacity: number; ha: boolean }; + storage: { + type: 'general_essd' | 'cloud_essd'; + // io 突发 + bursting: boolean; + // io加速 -serverless暂不支持配置 + ioAcceleration?: '1' | '0'; + // OptimizedWrites 写优化 - cdk暂无配置项 + optimizedWrites?: boolean; + // 云盘加密 + encryption?: boolean; + }; + } +>([ + [ + `${DatabaseEnum.RDS_MYSQL_SERVERLESS}-${DatabaseVersionEnum['MYSQL_5.7']}`, + { + engine: 'MySQL', + version: '5.7', + category: 'serverless_basic', + dbInstanceClass: 'mysql.n2.serverless.1c', + quota: { minCapacity: 0.5, maxCapacity: 32, ha: false }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: true, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_MYSQL_SERVERLESS}-${DatabaseVersionEnum['MYSQL_8.0']}`, + { + engine: 'MySQL', + version: '8.0', + category: 'serverless_basic', + dbInstanceClass: 'mysql.n2.serverless.1c', + quota: { minCapacity: 0.5, maxCapacity: 32, ha: false }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: true, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_MYSQL_SERVERLESS}-${DatabaseVersionEnum['MYSQL_HA_5.7']}`, + { + engine: 'MySQL', + version: '5.7', + category: 'serverless_standard', + dbInstanceClass: 'mysql.n2.serverless.2c', + quota: { minCapacity: 0.5, maxCapacity: 32, ha: true }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: true, encryption: true }, + }, + ], + [ + `${DatabaseEnum.RDS_MYSQL_SERVERLESS}-${DatabaseVersionEnum['MYSQL_HA_8.0']}`, + { + engine: 'MySQL', + version: '8.0', + category: 'serverless_standard', + dbInstanceClass: 'mysql.n2.serverless.2c', + quota: { minCapacity: 0.5, maxCapacity: 32, ha: true }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: true, encryption: true }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_14']}`, + { + engine: 'PostgreSQL', + version: '14.0', + category: 'serverless_basic', + dbInstanceClass: 'pg.n2.serverless.1c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: false }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_15']}`, + { + engine: 'PostgreSQL', + version: '15.0', + category: 'serverless_basic', + dbInstanceClass: 'pg.n2.serverless.1c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: false }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_16']}`, + { + engine: 'PostgreSQL', + version: '16.0', + category: 'serverless_basic', + dbInstanceClass: 'pg.n2.serverless.1c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: false }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_HA_14']}`, + { + engine: 'PostgreSQL', + version: '14.0', + category: 'serverless_standard', + dbInstanceClass: 'pg.n2.serverless.2c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: true }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_HA_15']}`, + { + engine: 'PostgreSQL', + version: '15.0', + category: 'serverless_standard', + dbInstanceClass: 'pg.n2.serverless.2c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: true }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_PGSQL_SERVERLESS}-${DatabaseVersionEnum['PGSQL_HA_16']}`, + { + engine: 'PostgreSQL', + version: '16.0', + category: 'serverless_standard', + dbInstanceClass: 'pg.n2.serverless.2c', + quota: { minCapacity: 0.5, maxCapacity: 14, ha: true }, + storage: { type: 'general_essd', bursting: true, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_MSSQL_SERVERLESS}-${DatabaseVersionEnum['MSSQL_HA_2016']}`, + { + engine: 'SQLServer', + version: '2016_std_sl', + category: 'serverless_ha', + dbInstanceClass: 'mssql.mem2.serverless.s2', + quota: { minCapacity: 2, maxCapacity: 8, ha: true }, + storage: { type: 'cloud_essd', bursting: false, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_MSSQL_SERVERLESS}-${DatabaseVersionEnum['MSSQL_HA_2017']}`, + { + engine: 'SQLServer', + version: '2017_std_sl', + category: 'serverless_ha', + dbInstanceClass: 'mssql.mem2.serverless.s2', + quota: { minCapacity: 2, maxCapacity: 8, ha: true }, + storage: { type: 'cloud_essd', bursting: false, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.RDS_MSSQL_SERVERLESS}-${DatabaseVersionEnum['MSSQL_HA_2019']}`, + { + engine: 'SQLServer', + version: '2019_std_sl', + category: 'serverless_ha', + dbInstanceClass: 'mssql.mem2.serverless.s2', + quota: { minCapacity: 2, maxCapacity: 8, ha: true }, + storage: { type: 'cloud_essd', bursting: false, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.ELASTICSEARCH_SERVERLESS}-${DatabaseVersionEnum['ES_SEARCH_7.10']}`, + { + engine: 'Elasticsearch', + version: '7.10', + category: 'STANDARD', + dbInstanceClass: '', + quota: { minCapacity: 2, maxCapacity: 8, ha: false }, + storage: { type: 'cloud_essd', bursting: false, optimizedWrites: false, encryption: false }, + }, + ], + [ + `${DatabaseEnum.ELASTICSEARCH_SERVERLESS}-${DatabaseVersionEnum['ES_TIME_SERIES_7.10']}`, + { + engine: 'Elasticsearch', + version: '7.10', + category: 'TRIAL', + dbInstanceClass: '', + quota: { minCapacity: 2, maxCapacity: 8, ha: false }, + storage: { type: 'cloud_essd', bursting: false, optimizedWrites: false, encryption: false }, + }, + ], +]); + export const resolveDatabases = ( scope: ros.Construct, databases: Array | undefined, @@ -13,13 +202,16 @@ export const resolveDatabases = ( return undefined; } databases!.forEach((db) => { + const { engine, version, category, dbInstanceClass, quota, storage } = + rdsEngineMap.get(`${db.type}-${db.version}`) ?? {}; + if ([DatabaseEnum.ELASTICSEARCH_SERVERLESS].includes(db.type)) { new esServerless.App( scope, replaceReference(db.key, context), { appName: replaceReference(db.name, context), - appVersion: db.version, + appVersion: version, authentication: { basicAuth: [ { @@ -28,9 +220,9 @@ export const resolveDatabases = ( ], }, quotaInfo: { - cu: db.cu, - storage: db.storageSize, - appType: db.engineMode === DatabaseEngineMode.TIMESERIES ? 'TRIAL' : 'STANDARD', + cu: db.cu.min, + storage: db.storage.min, + appType: category as string, }, // network: [ // { @@ -48,5 +240,86 @@ export const resolveDatabases = ( true, ); } + if ( + [ + DatabaseEnum.RDS_MYSQL_SERVERLESS, + DatabaseEnum.RDS_PGSQL_SERVERLESS, + DatabaseEnum.RDS_MSSQL_SERVERLESS, + ].includes(db.type) + ) { + new rds.DBInstance( + scope, + replaceReference(db.key, context), + { + engine: engine as string, + /** + * Serverless 实例 + * MySQL:5.7、8.0 - MYSQL_HA_5.7, MYSQL_5.7, MYSQL_HA_8.0, MYSQL_8.0 + * SQL Server:2016_std_sl、2017_std_sl、2019_std_sl - MSSQL_HA_2016, MSSQL_HA_2017, MSSQL_HA_2019 + * PostgreSQL:14.0、15.0、16.0 - PGSQL_HA_14, PGSQL_14 PGSQL_HA_15, PGSQL_15, PGSQL_HA_16,PGSQL_16 + */ + engineVersion: version as string, + dbInstanceStorage: replaceReference(db.storage.min, context), + /** Serverless 实例 + * serverless_basic:Serverless 基础系列。(仅适用 MySQL 和 PostgreSQL) + * serverless_standard:Serverless 高可用系列。(仅适用 MySQL 和 PostgreSQL) + * serverless_ha:SQL Server Serverless 高可用系列。 + */ + category, + /** + * MySQL: + * MySQL 基础系列:mysql.n2.serverless.1c + * MySQL 高可用系列:mysql.n2.serverless.2c + * SQL Server: + * mssql.mem2.serverless.s2 + * PostgreSQL + * 基础系列:pg.n2.serverless.1c + * 高可用系列:pg.n2.serverless.2c + */ + dbInstanceClass: dbInstanceClass as string, + /** + * 实例存储类型,取值: + * cloud_essd:ESSD PL1 云盘。 + * general_essd:通用云盘(推荐)。 + */ + dbInstanceStorageType: storage!.type, + burstingEnabled: storage!.bursting, + payType: 'Serverless', + /** + * MaxCapacity: + * MySQL:1~32 + * SQL Server:2~8 + * PostgreSQL:1~14 + * MinCapacity: + * MySQL:0.5~32 + * SQL Server:2~8(仅支持整数) + * PostgreSQL:0.5~14 + */ + serverlessConfig: { + // @TODO db.cu.min should get parameter value when it refer to a parameter + minCapacity: replaceReference( + db.cu.min === 0 ? quota!.minCapacity : db.cu.min + quota!.minCapacity, + context, + ), + maxCapacity: replaceReference( + db.cu.max + quota!.minCapacity <= quota!.maxCapacity + ? db.cu.max + quota!.minCapacity + : quota!.maxCapacity, + context, + ), + autoPause: db.cu.min === 0, + switchForce: false, + }, + masterUsername: replaceReference(db.security.basicAuth.username, context), + masterUserPassword: replaceReference(db.security.basicAuth.password, context), + masterUserType: 'Super', + multiAz: quota!.ha, + securityIpList: replaceReference(db.network.ingressRules.join(','), context), + connectionStringType: db.network.type === 'PRIVATE' ? 'Inner' : 'Public', + dbInstanceNetType: db.network.type === 'PRIVATE' ? 'Intranet' : 'Internet', + }, + true, + ); + } }); }; diff --git a/src/stack/rosStack/rosStack.ts b/src/stack/rosStack/rosStack.ts deleted file mode 100644 index e69de29..0000000 diff --git a/src/types/domains/database.ts b/src/types/domains/database.ts index 995ae03..f4ea356 100644 --- a/src/types/domains/database.ts +++ b/src/types/domains/database.ts @@ -1,42 +1,71 @@ -export enum DatabaseEngineMode { - SEARCH = 'SEARCH', - TIMESERIES = 'TIMESERIES', -} -export enum DatabaseEnum { +export const enum DatabaseEnum { ELASTICSEARCH_SERVERLESS = 'ELASTICSEARCH_SERVERLESS', + RDS_MYSQL_SERVERLESS = 'RDS_MYSQL_SERVERLESS', + RDS_PGSQL_SERVERLESS = 'RDS_PGSQL_SERVERLESS', + RDS_MSSQL_SERVERLESS = 'RDS_MSSQL_SERVERLESS', +} + +export const enum DatabaseVersionEnum { + 'MYSQL_5.7' = 'MYSQL_5.7', + 'MYSQL_8.0' = 'MYSQL_8.0', + 'MYSQL_HA_5.7' = 'MYSQL_HA_5.7', + 'MYSQL_HA_8.0' = 'MYSQL_HA_8.0', + PGSQL_14 = 'PGSQL_14', + PGSQL_15 = 'PGSQL_15', + PGSQL_16 = 'PGSQL_16', + PGSQL_HA_14 = 'PGSQL_HA_14', + PGSQL_HA_15 = 'PGSQL_HA_15', + PGSQL_HA_16 = 'PGSQL_HA_16', + MSSQL_HA_2016 = 'MSSQL_HA_2016', + MSSQL_HA_2017 = 'MSSQL_HA_2017', + MSSQL_HA_2019 = 'MSSQL_HA_2019', + 'ES_SEARCH_7.10' = 'ES_SEARCH_7.10', + 'ES_TIME_SERIES_7.10' = 'ES_TIME_SERIES_7.10', } export type DatabaseRaw = { name: string; type: DatabaseEnum; version: string; - engine_mode: DatabaseEngineMode; security: { basic_auth: { + master_user: string; password: string; }; }; network?: { - public: boolean; + type: 'PUBLIC' | 'PRIVATE'; + ingress_rules?: Array; + }; + cu?: { + min?: number; + max?: number; + }; + storage?: { + min: number; }; - cu: number; - storage_size: number; }; export type DatabaseDomain = { key: string; name: string; type: DatabaseEnum; - version: string; - engineMode: string; + version: DatabaseVersionEnum; security: { basicAuth: { + username: string; password: string; }; }; - network?: { - public: boolean; + network: { + type: 'PUBLIC' | 'PRIVATE'; + ingressRules: Array; + }; + cu: { + min: number; + max: number; + }; + storage: { + min: number; }; - cu: number; - storageSize: number; }; diff --git a/src/validator/databaseSchema.ts b/src/validator/databaseSchema.ts index 5f3a404..94ea56a 100644 --- a/src/validator/databaseSchema.ts +++ b/src/validator/databaseSchema.ts @@ -6,20 +6,57 @@ export const databaseSchema = { type: 'object', properties: { name: { type: 'string' }, - type: { type: 'string', enum: ['ELASTICSEARCH_SERVERLESS'] }, - version: { type: 'string' }, - engine_mode: { type: 'string', enum: ['SEARCH', 'TIMESERIES'] }, - cu: { type: 'number' }, - storage_size: { type: 'number' }, + type: { + type: 'string', + enum: [ + 'ELASTICSEARCH_SERVERLESS', + 'RDS_MYSQL_SERVERLESS', + 'RDS_PGSQL_SERVERLESS', + 'RDS_MSSQL_SERVERLESS', + ], + }, + version: { + type: 'string', + enum: [ + 'MYSQL_5.7', + 'MYSQL_8.0', + 'MYSQL_HA_5.7', + 'MYSQL_HA_8.0', + 'PGSQL_14', + 'PGSQL_15', + 'PGSQL_16', + 'PGSQL_HA_14', + 'PGSQL_HA_15', + 'PGSQL_HA_16', + 'MSSQL_HA_2016', + 'MSSQL_HA_2017', + 'MSSQL_HA_2019', + 'ES_SEARCH_7.10', + 'ES_TIME_SERIES_7.10', + ], + }, + cu: { + type: 'object', + properties: { + min: { type: 'integer', minimum: 0, maximum: 32 }, + max: { type: 'integer', minimum: 1, maximum: 32 }, + }, + }, + storage: { + type: 'object', + properties: { min: { type: 'integer', minimum: 20 } }, + required: ['min'], + }, security: { type: 'object', properties: { basic_auth: { type: 'object', properties: { + master_user: { type: 'string' }, password: { type: 'string' }, }, - required: ['password'], + required: ['master_user', 'password'], }, }, required: ['basic_auth'], @@ -27,11 +64,16 @@ export const databaseSchema = { network: { type: 'object', properties: { + type: { type: 'string', enum: ['PUBLIC', 'PRIVATE'] }, + ingress_rules: { + type: 'array', + items: { type: 'string' }, + }, public: { type: 'boolean' }, }, }, }, - required: ['name', 'type', 'version', 'security', 'cu', 'storage_size'], + required: ['name', 'type', 'version', 'security'], additionalProperties: false, }, }, diff --git a/tests/fixtures/deployFixture.ts b/tests/fixtures/deployFixture.ts index 4beff2b..09e012d 100644 --- a/tests/fixtures/deployFixture.ts +++ b/tests/fixtures/deployFixture.ts @@ -1,4 +1,4 @@ -import { DatabaseEnum, ServerlessIac } from '../../src/types'; +import { DatabaseEnum, DatabaseVersionEnum, ServerlessIac } from '../../src/types'; import { cloneDeep, set } from 'lodash'; import { ProviderEnum } from '../../src/common'; @@ -1192,7 +1192,7 @@ export const defaultContext = { stage: 'default', }; -export const esServerlessMinimumIac: ServerlessIac = { +export const esServerlessMinimumIac = { service: 'my-demo-es-serverless-service', version: '0.0.1', provider: { @@ -1204,18 +1204,18 @@ export const esServerlessMinimumIac: ServerlessIac = { key: 'insight_es_db_test', name: 'insight-poc-es-test', type: DatabaseEnum.ELASTICSEARCH_SERVERLESS, - version: '7.10', - engineMode: 'SEARCH', + version: DatabaseVersionEnum['ES_SEARCH_7.10'], security: { basicAuth: { + username: 'test-username', password: 'test-password', }, }, - cu: 1, - storageSize: 20, + cu: { min: 1, max: 8 }, + storage: { min: 20 }, }, ], -}; +} as unknown as ServerlessIac; export const esServerlessMinimumRos = { Description: 'my-demo-es-serverless-service stack', diff --git a/tests/fixtures/serverless-insight-es.yml b/tests/fixtures/serverless-insight-es.yml index 3d3c701..c664906 100644 --- a/tests/fixtures/serverless-insight-es.yml +++ b/tests/fixtures/serverless-insight-es.yml @@ -14,11 +14,13 @@ databases: insight_es_db: name: insight-poc-es type: ELASTICSEARCH_SERVERLESS - version: '7.10' - engine_mode: SEARCH - cu: 1 - storage_size: 20 + version: ES_SEARCH_7.10 + cu: + min: 1 + max: 6 + storage: + min: 20 security: basic_auth: + master_user: 'test-username' password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg' - diff --git a/tests/fixtures/serverless-insight.yml b/tests/fixtures/serverless-insight.yml index 5ad9b04..cc789b0 100644 --- a/tests/fixtures/serverless-insight.yml +++ b/tests/fixtures/serverless-insight.yml @@ -36,18 +36,6 @@ functions: TEST_VAR: ${vars.testv} TEST_VAR_EXTRA: abcds-${vars.testv}-andyou -#databases: -# insight_es_db: -# name: insight-poc-es -# type: ELASTICSEARCH_SERVERLESS -# version: 7.10 -# engine_mode: SEARCH -# security: -# basic_auth: -# password: 123456 -# cu: 1 -# storage_size: 20 - events: gateway_event: type: API_GATEWAY diff --git a/tests/parser/parse.test.ts b/tests/parser/parse.test.ts index d28c08a..4806aba 100644 --- a/tests/parser/parse.test.ts +++ b/tests/parser/parse.test.ts @@ -23,15 +23,24 @@ describe('unit test for parse', () => { key: 'insight_es_db', type: 'ELASTICSEARCH_SERVERLESS', name: 'insight-poc-es', - engineMode: 'SEARCH', - version: '7.10', + version: 'ES_SEARCH_7.10', security: { basicAuth: { + username: 'test-username', password: 'U34I6InQ8elseTgqTWT2t2oFXpoqFg', }, }, - cu: 1, - storageSize: 20, + network: { + ingressRules: ['0.0.0.0/0'], + type: 'PRIVATE', + }, + cu: { + min: 1, + max: 6, + }, + storage: { + min: 20, + }, }, ], });