pulumi-azure icon indicating copy to clipboard operation
pulumi-azure copied to clipboard

If there are 1 or more Storage Blobs, running "pulumi up" after running "pulumi refresh" will crash

Open BillHally opened this issue 4 years ago • 4 comments

Running pulumi refresh against a deployment which contains an Azure.Storage.Blob resource corrupts Pulumi's stored state, causing later runs of pulumi up to crash.

Steps to reproduce

  1. Create a new Pulumi project and add an Azure.Storage.Blob resource
  2. Run pulumi up to deploy it
  3. Run pulumi refresh to update the stored state
  4. Run pulumi up

Expected result

pulumi up completes successfully without changing anything

Actual result

  1. Diffing the contents of the JSON state files (i.e. diff .pulumi/stacks/<stackname>.json.bak .pulumi/stacks/<stackname>.json) shows changes like this:
<                         "source": {
<                             "4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
<                             "hash": "c12e562b71df7fb8f56c0d020b326f1f353fa787c7082ce2a2a901b8dda5651d",
<                             "path": "wwwroot"
<                         },
---
>                         "source": "C:\\Users\\<username>\\AppData\\Local\\Temp\\pulumi-asset-c12e562b71df7fb8f56c0d020b326f1f353fa787c7082ce2a2a901b8dda5651d",
  1. pulumi up crashes with the following exception:
    System.InvalidOperationException: Expected Pulumi.AssetOrArchive but got System.String deserializing Pulumi.Azure.Storage.Blob.source
       at Pulumi.Serialization.Converter.ConvertObject(String context, Object val, Type targetType)
       at Pulumi.Serialization.Converter.ConvertValue(String context, Value value, Type targetType, ImmutableHashSet`1 resources)
       at Pulumi.Deployment.CompleteResourceAsync(Resource resource, Boolean remote, Func`2 newDependency, ResourceArgs args, ResourceOptions options, ImmutableDictionary`2 completionSources)
       at Pulumi.Output`1.Pulumi.IOutput.GetDataAsync()
       at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop, Boolean keepResources)
       at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey, Boolean keepResources)
       at Pulumi.Deployment.SerializeAllPropertiesAsync(String label, IDictionary`2 args, Boolean keepResources)
       at Pulumi.Deployment.RegisterResourceOutputsAsync(Resource resource, Output`1 outputs)
       at Pulumi.Deployment.Runner.<>c__DisplayClass7_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()
       --- End of stack trace from previous location where exception was thrown ---                                                                
       at Pulumi.Deployment.Runner.WhileRunningAsync()        
       at Pulumi.Deployment.Runner.<>c__DisplayClass7_0.<<WhileRunningAsync>g__HandleCompletion|0>d.MoveNext()

Repo which demonstrates the issue

https://github.com/BillHally/pulumi-azure-fs-blob-refresh-failure-repro

Other information

  • Backend: self-managed
  • Runtime: .Net Core 3.1
  • Language: F#
  • Pulumi CLI version: v.2.13.2
  • Pulumi.Azure version: 3.30.0
  • Pulumi.FSharp version: 2.13.2

BillHally avatar Nov 09 '20 16:11 BillHally

@BillHally Did you find a workaround for this? Have just run into the same issue.

scp-mb avatar Nov 30 '20 10:11 scp-mb

@scp-mb no, unfortunately.

BillHally avatar Nov 30 '20 10:11 BillHally

Unfortunate. I've had to manually rip out those entities from the state to ensure I can continue on 😟

scp-mb avatar Nov 30 '20 10:11 scp-mb

Same issue here

Jonne avatar Sep 17 '21 12:09 Jonne