dry-leather-4467
01/27/2025, 11:56 AMprivate createApiGatewayDeployment(name: string, integrations: aws.apigateway.Integration[], resources: aws.apigateway.Resource[]): aws.apigateway.Deployment {
const triggersHash = pulumi.all([
integrations.map(m => m.id).sort(),
resources.map(r => r.id).sort()
])
.apply(([iIds, rIds]) => {
return crypto.createHash('sha256')
.update(JSON.stringify([iIds, rIds]))
.digest('hex');
})
return new aws.apigateway.Deployment(`${name}-deployment`, {
restApi: this.api.id,
triggers: {
redeploy: triggersHash
}
, {parent: this});
}
The Pulumi output:
...
@ updating....
+ aws:apigateway:Method xxx-PATCH-method creating (0s)
...
...
...
@ updating....
.
+ aws:apigateway:Method xxx-PATCH-method created (2s)
@ updating....
+ aws:apigateway:Integration xxx-PATCH-integration creating (0s)
@ updating....
.
+ aws:apigateway:Integration xxx-PATCH-integration created (1s)
@ updating....
++ aws:apigateway:Deployment xxx-deployment creating replacement (0s) [diff: ~triggers]
@ updating....
.
++ aws:apigateway:Deployment xxx-deployment created replacement (1s) [diff: ~triggers]
@ updating....
+- aws:apigateway:Deployment xxx-deployment replacing (0s) [diff: ~triggers]
+- aws:apigateway:Deployment xxx-deployment replaced (0.00s) [diff: ~triggers]
~ aws:apigateway:Stage xxx-stage updating (0s) [diff: ~deployment]
@ updating....
~ aws:apigateway:Stage xxx-stage updated (1s) [diff: ~deployment]
@ updating....
.
-- aws:apigateway:Deployment xxx-deployment deleting original (0s) [diff: ~triggers]
@ updating....
-- aws:apigateway:Deployment xxx-deployment deleted original (1s) [diff: ~triggers]
@ updating....
- aws:apigateway:Integration xxx-ANY-integration deleting (0s)
@ updating....
- aws:apigateway:Integration xxx-ANY-integration deleted (1s)
@ updating....
- aws:apigateway:Method xxx-ANY-method deleting (0s)
@ updating....
.
- aws:apigateway:Method xxx-ANY-method deleted (1s)
@ updating....
...
You can see that the Deployment is changed before the deletes are executedlittle-cartoon-10569
01/28/2025, 6:23 PMdry-leather-4467
01/29/2025, 7:09 AMlittle-cartoon-10569
01/29/2025, 7:45 PMpulumi up
twice to delete a resource isn't a good solution. Someone will forget, and resources will end up not being deleted.dry-leather-4467
01/30/2025, 6:31 AM