https://pulumi.com logo
Title
p

purple-orange-91853

07/20/2021, 9:27 PM
I'm trying to get our Redis deployment files updated and when I run pulumi up I am getting this error back. I have tried to export my state for the stack and remove the
"snapshotArns": [],
and reimport the state. I am not sure what is causing this to break as it has worked before.
aws:elasticache:Cluster (redis-temp):                                                                        
    error: unmarshaling urn:pulumi:temp::aws-us-east-1-redis::aws:elasticache/cluster:Cluster::redis-temp's instance state: could not read field snapshot_arns: '' expected type 'string', got unconvertible type '[]interface {}', value: '[]'
This is the relevant section in the ts file for this deployment
const redis = new elasticache.Cluster(
    `redis-${deploymentName}`,
    {
      // azMode,
      numCacheNodes: 1,
      engine: 'redis',
      // engineVersion: '6.x',
      engineVersion: '6.0.5',
      nodeType: 'cache.m4.large',
      subnetGroupName: redisSubnetGroup.id,
      securityGroupIds: [redisSecurityGroup.id],
      port: 6379
    }
    // { ignoreChanges: ['engineVersion'] }
  )
l

little-cartoon-10569

07/20/2021, 9:54 PM
You could try ignoring snapshotArns? The docs say that snapshotArns must be a single-element array, so if ignoring it doesn't work, you could try changing it to
"snapshotArns":[""]
?
However ignoring it looks like the safer option...
p

purple-orange-91853

07/20/2021, 10:02 PM
let me try that
ok, tried
{ ignoreChanges: ['snapshotArns'] }
and then tried
snapshotArns: [""]
and
snapshotArns: ''
. All three are producing errors. The ignore changes produces this error:
error: aws:elasticache/cluster:Cluster resource 'redis-temp' has a problem: Attribute must be a single valu
e, not a list. Examine values at 'Cluster.SnapshotArns'.
While the last produced the same error as originally posted. Using the
[]
in the middle gives me an error in the editor
Type 'string[]' is not assignable to type 'Input<string> | undefined'.
  Type 'string[]' is not assignable to type 'string'.
l

little-cartoon-10569

07/20/2021, 10:28 PM
Hmm... yea, I read the definition of the param without reading the type of the param.
string
is correct, and the definition Single-element string list is wrong.
Since the attribute is not in your code, and the problem is happening during an
up
, then I infer that there's a difference between what's in the state and what the provider requires. Possibly the provider's version has changed recently? Maybe running
pulumi refresh
, at least on that resource, would "fix" the Pulumi state?
p

purple-orange-91853

07/20/2021, 10:37 PM
I have tried that. I exported the state and manually deleted the two snapshotArns lines then imported that and did a refresh
l

little-cartoon-10569

07/20/2021, 10:37 PM
And refresh puts the "snapshotArns": [] back? Hmm.. that's awkward.
p

purple-orange-91853

07/20/2021, 10:37 PM
yeah
I've put a refresh just before the pulumi up in my code deploy to see if that changes anything which is running now
l

little-cartoon-10569

07/20/2021, 10:38 PM
You can put
--refresh
in the parameters to a preview or up...
p

purple-orange-91853

07/20/2021, 10:39 PM
good to know
l

little-cartoon-10569

07/20/2021, 10:39 PM
Also you can export just before and after a refresh, to see what changes...
I think we should find out who created the provider and ask for help from dev team...
Or raise an issue on github.
p

purple-orange-91853

07/20/2021, 10:40 PM
actually I think we already had that... we have a
-r
in our pulumi up command
l

little-cartoon-10569

07/20/2021, 10:42 PM
Maybe try removing that after editing your state? Perhaps you're fixing it then overwriting your fix before `up`ing.
p

purple-orange-91853

07/20/2021, 10:44 PM
just tried the export, remove the snapshotArns from the state file, and then reimported. did a
pulumi up --non-interactive --yes -r
which failed with the same error. then re-exported teh state to confirm and the snapshotArns lines were gone
l

little-cartoon-10569

07/20/2021, 10:45 PM
Try it without the
-r
. That will be updating your state after you import it and before the
up
.
You want to test your version of the state, not the providers' version.
If that works, then you know there's an issue / bug in the provider, and you should raise it in GitHub.
p

purple-orange-91853

07/20/2021, 10:54 PM
ok, so I removed the
-r
. Manually refreshed the state with
pulumi refresh
, exported the state and manually removed the lines containing `snapshotArns`and then re-imported the state. Then did
pulumi up --non-interactive --yes
which has now resulted in a new error about existing securityGroups which is not related to the original issue.
so it appears that by removing those lines from state and updating the state manually worked around the initial issue.
without doing a
refresh
inbetween steps
I'll write up a bug report into Github tomorrow morning on this
👍 1