Why is the wrong cluster not deleted first?
# general
l
Why is the wrong cluster not deleted first?
w
Pulumi does create-before-replace by default, to reduce downtime. You can opt in to
deleteBeforeReplace: true
if you want replacements to delete first (increasing downtime, but allowing you to use the same id for the two resources). This is in general only a problem if you manually force the name of the resource to a specific value instead of relying on Pulumi's auto-naming (which would ensure the original and replacement don't conflict). We are considering having explicit naming automatically change
deleteBeforeReplace
to
true
to ease this process in the common case in https://github.com/pulumi/pulumi-terraform/issues/383.
👍🏼 1
l
I was used to name my resources in Terraform myself. Was it a design decision not to do this in Pulumi?
w
Creating before replacing by default ensures much better uptime for infrastructure - especially for more "modern" infrastructure. To get good uptime in Terraform you have to sprinkle your config with
create_before_destroy
. The fact that this is the default in Pulumi ensures that you get effectively mini-blue/green deployments on every update. And in case something does fail - you are not in a state of your infrastructure being fundamentally broken (also the norm in Terraform deployments).
l
@white-balloon-205 how does this relate to the
namePrefix
attribute that came into the picture on TF resources?
w
Similarly - in Pulumi something like
namePrefix
is the default for all resources. Pulumi makes the
name
property optional on ~all resources, and automatically generates a name seeded from the Pulumi resource name with a random suffix. This accomplishes a similar goal as
namePrefix
, but again uses the safer approach as the default and applies this to everythign instead of only a handful of resources. More on this here: https://www.pulumi.com/docs/reference/programming-model/#autonaming