https://pulumi.com logo
#automation-api
Title
# automation-api
h

hundreds-musician-51496

11/17/2020, 7:07 PM
Does the automation API allow me to control what resources get updated/deleted? Is there any sort of lifecycle hook where I can affect the state of the stack or similar before pulumi performs an update?
Context is trying to work around this Lambda@Edge situation where AWS will not delete the lambda function (in fact, it happens automatically) and pulumi throws an error when trying to update.
l

lemon-agent-27707

11/17/2020, 7:11 PM
I suppose you could use automation API to remove the resource from the state file using stack.export/stack.import, but that's a bit messy.
Alternatively, why not just create the resource via the AWS SDK? It sounds like you don't really want to manage it with a desired state model.
h

hundreds-musician-51496

11/17/2020, 7:13 PM
Well I do want it as part of my deployment and I really like the function serialization that pulumi provides
But that is a possible workaround, thank you
g

gifted-student-18589

11/17/2020, 7:14 PM
we are doing similar thing with
aws:iam:ServiceLinkedRole
, where, before running the
pulumi up
, we just check if the role is there (using the AWS SDK)
h

hundreds-musician-51496

11/17/2020, 7:14 PM
Its really amazon's fault
g

gifted-student-18589

11/17/2020, 7:14 PM
once the check is done,
pulumi up
proceeds doing its thing
not sure if this is related to your scenario, but still mentioned it just in case 🙂
h

hundreds-musician-51496

11/17/2020, 7:16 PM
thank you 🙂
🚀 1
l

lemon-agent-27707

11/17/2020, 7:38 PM
It would be worth opening an issue in the AWS provider. There may be something we can do at a lower level to support this.
h

hundreds-musician-51496

11/17/2020, 8:07 PM
I found this, which suggests using
pulumi state delete
to remove the fucntion from the state ... https://github.com/pulumi/pulumi-aws/issues/1045