@certenza/aws-cdk-infrastructure-commons 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/apigateway.js +16 -1
- package/package.json +10 -6
package/dist/src/apigateway.js
CHANGED
|
@@ -93,12 +93,24 @@ const createApiGateway = (scope, apiName, domainName, hostedZoneId, zoneName) =>
|
|
|
93
93
|
retention: logs.RetentionDays.ONE_MONTH, // Budget-friendly: 1 month retention
|
|
94
94
|
removalPolicy: cdk.RemovalPolicy.DESTROY, // Destroy log group when API is deleted
|
|
95
95
|
});
|
|
96
|
-
// Create deployment
|
|
96
|
+
// Create deployment that automatically updates when API changes
|
|
97
|
+
// To ensure the stage updates when new methods/resources are added, we include
|
|
98
|
+
// the API root resource ID in the deployment description. This forces CloudFormation
|
|
99
|
+
// to recognize when the API changes and update both the deployment and stage.
|
|
97
100
|
const deployment = new apigateway.Deployment(scope, `${apiName}-Deployment`, {
|
|
98
101
|
api: api,
|
|
102
|
+
retainDeployments: false,
|
|
99
103
|
});
|
|
104
|
+
// Add dependency on API root to ensure deployment updates when API changes
|
|
105
|
+
// This ensures the deployment is recreated when methods/resources are added
|
|
106
|
+
deployment.node.addDependency(api.root);
|
|
107
|
+
// Ensure stage depends on deployment to update when deployment changes
|
|
108
|
+
// This forces the stage to update its deployment reference when a new deployment is created
|
|
100
109
|
// Create stage with logging configuration
|
|
101
110
|
// The execution log group must exist before the stage is created so API Gateway uses it
|
|
111
|
+
// IMPORTANT: The stage must reference the deployment. When a new deployment is created
|
|
112
|
+
// (when API methods/resources change), CloudFormation should update the stage automatically.
|
|
113
|
+
// However, to ensure this works, we add an explicit dependency and include deployment info.
|
|
102
114
|
const stage = new apigateway.Stage(scope, `${apiName}-Stage`, {
|
|
103
115
|
deployment: deployment,
|
|
104
116
|
stageName: "prod",
|
|
@@ -106,6 +118,9 @@ const createApiGateway = (scope, apiName, domainName, hostedZoneId, zoneName) =>
|
|
|
106
118
|
dataTraceEnabled: false,
|
|
107
119
|
accessLogDestination: new apigateway.LogGroupLogDestination(accessLogGroup),
|
|
108
120
|
});
|
|
121
|
+
// Explicitly add dependency to ensure stage updates when deployment changes
|
|
122
|
+
// This is necessary because CloudFormation might not detect the change automatically
|
|
123
|
+
stage.node.addDependency(deployment);
|
|
109
124
|
// Ensure the execution log group is created before the stage
|
|
110
125
|
// This is necessary because the stage doesn't reference the log group directly,
|
|
111
126
|
// but API Gateway needs it to exist when the stage is created
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@certenza/aws-cdk-infrastructure-commons",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Common infrastructure reusable utilities and resources for Certenza projects",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -9,12 +9,16 @@
|
|
|
9
9
|
],
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "tsc",
|
|
12
|
-
"
|
|
13
|
-
"prebuild": "npm run
|
|
12
|
+
"clean_up": "rimraf dist",
|
|
13
|
+
"prebuild": "npm run clean_up",
|
|
14
14
|
"prepublishOnly": "npm run build",
|
|
15
15
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
16
16
|
"format": "prettier --write .",
|
|
17
|
-
"format:check": "prettier --check ."
|
|
17
|
+
"format:check": "prettier --check .",
|
|
18
|
+
"git_clean": "sh -c 'git checkout main && git pull origin main && git branch -D \"$1\" && git remote update origin --prune' sh",
|
|
19
|
+
"git_release": "sh -c 'git add . && git commit -m \"$1\" && git push origin \"$1\"' sh",
|
|
20
|
+
"clean": "npm run git_clean -- ",
|
|
21
|
+
"release": "npm run git_release -- "
|
|
18
22
|
},
|
|
19
23
|
"keywords": [
|
|
20
24
|
"aws",
|
|
@@ -36,11 +40,11 @@
|
|
|
36
40
|
},
|
|
37
41
|
"homepage": "https://github.com/certenza/aws-cdk-infrastructure-commons#readme",
|
|
38
42
|
"dependencies": {
|
|
39
|
-
"aws-cdk-lib": "^2.
|
|
43
|
+
"aws-cdk-lib": "^2.232.1"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
46
|
"@types/node": "^24.0.0",
|
|
43
|
-
"prettier": "^3.7.
|
|
47
|
+
"prettier": "^3.7.4",
|
|
44
48
|
"rimraf": "^6.1.2",
|
|
45
49
|
"typescript": "^5.9.3"
|
|
46
50
|
},
|