File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -283,19 +283,23 @@ func (p *NitricAzurePulumiProvider) Website(ctx *pulumi.Context, parent pulumi.R
283283 return err
284284 }
285285
286- // Check if the file has changed
287- objectKeyOutput := existingMd5Output .ApplyT (func (existingMd5 string ) pulumi.StringOutput {
288- // Get the MD5 hash of the new file
289- return blob .ContentMd5 .ApplyT (func (newMd5 * string ) pulumi.StringOutput {
290- if newMd5 != nil && existingMd5 != * newMd5 {
291- return pulumi .String (objectKey ).ToStringOutput ()
292- }
286+ keyToInvalidate := pulumi .All (blob .ContentMd5 , existingMd5Output ).ApplyT (func (args []any ) (string , error ) {
287+ newMd5 , newMd5Ok := args [0 ].(* string )
288+ existingMd5 , existingMd5Ok := args [1 ].(string )
289+
290+ if ! newMd5Ok || ! existingMd5Ok {
291+ return "" , fmt .Errorf ("failed to assert md5 types" )
292+ }
293+
294+ // if an existing ETag is present and it is different from the new ETag, return the key to invalidate
295+ if existingMd5 != "" && newMd5 != nil && * newMd5 != existingMd5 {
296+ return objectKey , nil
297+ }
293298
294- return pulumi .String ("" ).ToStringOutput ()
295- }).(pulumi.StringOutput )
299+ return "" , nil
296300 }).(pulumi.StringOutput )
297301
298- p .websiteChangedFileOutputs = append (p .websiteChangedFileOutputs , objectKeyOutput )
302+ p .websiteChangedFileOutputs = append (p .websiteChangedFileOutputs , keyToInvalidate )
299303
300304 return nil
301305 })
You can’t perform that action at this time.
0 commit comments