I'm trying to add the DeleteBeforeReplace flag whe...
# aws
I'm trying to add the DeleteBeforeReplace flag when I'm constructing a new awsx.ecs.EC2Service (or Fargate) but that doesn't seem to work, is there any option to force it other than giving the resource a name? that also doesn't seem to work
What's not working? Are you causing a replace, and it's attempting to create a 2nd one before deleting the 1st one?
If you're doing this, the follow-up question is: are you adding the flag at the same time as the expected delete/replace/create action? Because the flag may need to be added first.
I know for the protected opt, it doesn't "work" if you add the opt in the same code change that deletes the resource. For example, if you change the Pulumi name and set the protected opt, then the old resource does get deleted, then the new resource is created with the protected opt.
This may be happening in this case too. Try adding the deleteBeforeReplace opt with zero other changes (and up it), then after the opt is added, make your other changes that cause the replace.
The main problem is that my code doesn't compile, the docs and the source code are different in terms of the the type of the opts in these constructors - in the same version the docs list the opts as a CustomResourceOptions while in the code it's a ComponentResourceOptions and the code doesn't compile with a deleteBeforeReplace flag provided
You can't pass it to the awsx resource, it isn't a real resource, it's just a wrapper. You need to pass it to the aws resource.
You can either use a transformation (https://www.pulumi.com/docs/intro/concepts/resources/options/transformations/) or switch to using aws or aws-native.
If you're not just quickly running up a test app, then I recommend not using awsx. IMO, the convenience it offers is at the cost of too many things that are important in a production environment.