https://pulumi.com logo
#python
Title
# python
a

average-school-38756

01/09/2021, 9:41 PM
i'm attempting to split a stack into two stacks. For the most part, using the
_import
option is working well. One case which is not working is trying to use an existing AWS Lambda function. There is some difference detected in the
code
property:
Copy code
+   pulumi:pulumi:Stack              hello-dev                     create     1 error
...
 =   ├─ aws:lambda:Function           exampleLambda                 import     [diff: +code]; 1 warning
...
aws:lambda:Function (exampleLambda):
    warning: inputs to import do not match the existing resource; importing this resource will fail
Original code looks like this:
Copy code
lambda_.Function("exampleLambda",
    role=lambda_role.arn,
    runtime="python3.7",
    handler='hello.handler',
    code=pulumi.AssetArchive({
        '.': pulumi.FileArchive('./hello')
    })
)
State looks like this:
Copy code
{
  "4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
  "assets": {
    ".": {
      "4dabf18193072939515e22adb298388d": "0def7320c3a5731c473e5ecbe6d01bc7",
      "hash": "935cf7f6edab4c54246b65708d75c720b7e47142e4c0d70ed8e7803ec63b4883",
      "path": "./hello"
    }
  },
  "hash": "935cf7f6edab4c54246b65708d75c720b7e47142e4c0d70ed8e7803ec63b4883"
}
How can i detect and address the difference detected when
pulumi up
is run?
Copy code
$ pulumi preview --diff
...
warning: inputs to import do not match the existing resource; importing this resource will fail
    = aws:lambda/function:Function: (import)
        [id=exampleLambda-2775aa5]
        [urn=urn:pulumi:dev::hello::aws:lambda/function:Function::exampleLambda]
        [provider=urn:pulumi:dev::hello::pulumi:providers:aws::default_3_20_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
      + code: archive(assets:935cf7f) {
      +     ".": archive(assets:935cf7f) {
            }
        }
well very strange, but removing the code property altogether makes the import validate. i suppose i can add it back after i get the stack initialized