average-school-38756
01/09/2021, 9:41 PM_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:
+ 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:
lambda_.Function("exampleLambda",
role=lambda_role.arn,
runtime="python3.7",
handler='hello.handler',
code=pulumi.AssetArchive({
'.': pulumi.FileArchive('./hello')
})
)
State looks like this:
{
"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?
$ 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) {
}
}