icy-controller-6092
01/07/2024, 8:30 AMdry-keyboard-94795
01/07/2024, 11:46 AMechoing-dinner-19531
01/08/2024, 2:21 PMWhy do the inputs have to match? iIf they didn't you would have differences between what your state records and what the actual cloud state is. If you use the
import
command we warn about this but it's not an error, because you still have a chance between the run of import
and up
to run refresh
to fix it.
But if using the import option the engine wants to do any update there and then, there's no opportunity to run refresh or fix another way. So we have the option of either
A) Error
B) Ignore the inputs defined in your program
Given the whole point of up
is to make the cloud state look like what your program says that pretty much excludes doing B.dry-keyboard-94795
01/08/2024, 2:35 PMicy-controller-6092
01/08/2024, 10:34 PMicy-controller-6092
01/08/2024, 10:38 PMicy-controller-6092
01/08/2024, 10:51 PMechoing-dinner-19531
01/08/2024, 11:31 PMwhen using the import option can the resource not spawn both an import and an update into the plan?We could, but now you need to be careful about watching for warnings on preview (and hopefully your running preview not just up) to check that your not inadvertently changing a resource that you thought you were just importing. This is very much a trying to find a balance for good overall UX thing, not a technical thing.
icy-controller-6092
01/08/2024, 11:48 PMechoing-dinner-19531
01/08/2024, 11:52 PMechoing-dinner-19531
01/08/2024, 11:53 PMimportAsIsIReallyMeanIt: true
but then you need to work out a good UX around making sure people are aware of that option and what exactly it meansicy-controller-6092
01/08/2024, 11:54 PMicy-controller-6092
01/08/2024, 11:55 PMicy-controller-6092
01/08/2024, 11:57 PMechoing-dinner-19531
01/09/2024, 12:00 AMthere are no gutter guards in that scenario, so I don't see why they should be additional guards for the import flow?Well there can't be any guards in that case, we've got nothing to compare against.
trepidation around imports has really put me off that as a flow for moving resources between stacksThe
pulumi import
command is probably better for this, but I'd really like to write a proper transfer command at some point. Something like transfer stackA/resA stackB/resB
to transfer resA from stackA to stackB and call it resB.icy-controller-6092
01/09/2024, 12:04 AMwe've got nothing to compare againstfor an update, you are comparing against the previously known state
this would be a fantastic addition, it might even be a good idea to alert people in the docs that they should use microstacks for new projects only -- and wait untiltransfer stackA/resA stackB/resB
transfer
is available before refactoring existing projects into microstacks
this is the page where the warning should be placed: https://www.pulumi.com/docs/using-pulumi/organizing-projects-stacks/echoing-dinner-19531
01/09/2024, 12:15 AMfor an update, you are comparing against the previously known stateWell yes, but you clearly need to be able to change things in that scenario. If we err'd that the inputs didn't match you'd never be able to change anything.
this would be a fantastic additionYeh I'll talk to docs about that
icy-controller-6092
01/09/2024, 12:17 AMupdate
- the program needs to be effective - i think it should also not be done for import
matching inputs is sometimes not even possible in the context of the new stack, for example inputs might need to be changed to reflect the destination stack environment - and having the imported resource still reflecting the old context after a successful import also seems like a inconsistent state to leave your program in between runsechoing-dinner-19531
01/09/2024, 12:22 AMwhy even err when the inputs don't match, in the import scenario?Because it was quite common for people to think they were importing a resource exactly as is but inadvertently causing an update because the inputs didn't exactly match. Arguably this is user error and they should have looked at the preview more closely but alas humans are human.
and having the imported resource still reflecting the old context after a successful import also seems like a inconsistent state to leave your program in between runsYes, that's a good case for when you really do mean to import and then update in the same operation. It might be worth raising an issue to discuss this. It may be that we can solicit enough input that it would be ok to just allow import/update in one step.