is there an advantage of running `pulumi destroy` ...
# general
q
is there an advantage of running
pulumi destroy
before running a
pulumi up
?
m
The advantage of keeping the infrastructure you've already deployed.
q
what do you mean? Won't a destory remove any infrastructure I've already deployed?
b
yes, but
pulumi up
can update something in place if there is no significant changes
q
so a destroy then up will, in effect, cause my deployments to be slower?
b
In general yes. But, maybe you misunderstood the concept how pulumi/terraform works.
pulumi up
or
terraform apply
updates the existing stack and changes could be destructive(or not, depends on changes really).
f
If you
destroy
before
up
, all your infrastructure goes away, and you will have nothing until
up
has finished running. Fine for testing environments, perhaps, but likely not ever something you want to do for production!
b
in other words - terraform/pulumi can be used to deploy ephemeral infra, but, it also can be used to deploy long-living infra and you can’t just destroy it
q
I'm using octopus to deploy my AWS resources. I made a couple of changes to my deployment (I didn't touch stack names at all) but am running into failures with
pulumi up
saying that
error deleting API Gateway Deployment (htkn4s): BadRequestException: Active stages pointing to this deployment must be moved or deleted.
so I'm debating running pulumi destroy before an up. I don't use DynamoDB or anything like it.
f
You can also destroy individual resources with the
--target
/
--target-dependents
options... not saying that's the best solution for your particular situation, but I imagine it would be preferable to a total
destroy
.
b
which aws resources you are changing in this example? that could be an issue with aws provider or your changes to code was significant and somewhere in between lost some
depends_on
information
q
Copy code
-- aws:lambda:Permission localization-rest-api-bronze-d11dda69 deleted original  
April 11th 2022 14:41:06Info
 -- aws:lambda:Permission localization-rest-api-bronze-7c8386b9 deleting original  
April 11th 2022 14:41:06Info
 ++ aws:iam:RolePolicyAttachment bronze-attach-execute created replacement [diff: ~role] 
April 11th 2022 14:41:06Info
 ++ aws:iam:RolePolicyAttachment bronze-attach-sqs-queue-execute created replacement [diff: ~role] 
April 11th 2022 14:41:06Info
 -- aws:lambda:Permission localization-rest-api-bronze-7c8386b9 deleted original  
April 11th 2022 14:41:06Info
 -- aws:apigateway:Deployment localization-rest-api-bronze deleting original  
April 11th 2022 14:41:06Info
 -- aws:apigateway:Deployment localization-rest-api-bronze deleting original error: deleting urn:pulumi:bronze::paylocity.localization.timezones::aws:apigateway:x:API$aws:apigateway/deployment:Deployment::localization-rest-api-bronze: 1 error occurred: 
April 11th 2022 14:41:06Info
 -- aws:apigateway:Deployment localization-rest-api-bronze **deleting failed** error: deleting urn:pulumi:bronze::paylocity.localization.timezones::aws:apigateway:x:API$aws:apigateway/deployment:Deployment::localization-rest-api-bronze: 1 error occurred: 
April 11th 2022 14:41:10Info
 +  aws:lambda:LayerVersion common-layer-bronze created  
April 11th 2022 14:41:20Info
@ updating.... ~  aws:lambda:Function health-check-bronze updated [diff: ~environment,role] 
April 11th 2022 14:41:20Info
 +  aws:lambda:Function persist-timezone-preference-bronze created  
April 11th 2022 14:41:25Info
 ~  aws:lambda:Function localization-onTopicInserted-bronze updated [diff: ~code,environment,role] 
April 11th 2022 14:41:25Info
    pulumi:pulumi:Stack paylocity.localization.timezones-bronze running error: update failed 
April 11th 2022 14:41:25Info
    pulumi:pulumi:Stack paylocity.localization.timezones-bronze **failed** 1 error
b
I am not that familiar with Lambda, but from the error looks like you are trying to delete deployment which is currently active. technically you need to create a new deployment, point to it and then delete the old one. How it is implemented in your code and how pulumi from that code created that plan I don’t know
without the code would be hard to say
q
gotcha
it's a good thing I'm not using DynamoDB lol
f
(It's been a while since I've done anything with Lambdas and API Gateway, so I unfortunately don't have much to contribute to this portion of the discussion 🤷)
q
it's all good! Thanks for the help! 🙂
f
Good luck!
q
I might have to temporarily update my deployment to delete my resources then do an up.