sparse-intern-71089
07/28/2021, 1:39 PMbored-oyster-3147
07/28/2021, 1:53 PMpulumi refresh
and not update your pulumi state unless there are no changes or unless you do --expect-no-changes
but I don't think that is what you are looking for.
Is pulumi preview
not what you are looking for? To clarify, you don't want to see the difference between your Pulumi Code & Actual State but rather, your Pulumi State & Actual State?bored-oyster-3147
07/28/2021, 1:54 PM--diff --expect-no-changes
with pulumi refresh
will give you what you are looking for? Since it will error out if there are changes so won't change anything, and the --diff
hopefully gives you the rich diff you're looking forlittle-whale-73288
07/28/2021, 2:32 PMlittle-whale-73288
07/28/2021, 2:32 PMfilip@FZYZNIEWT15G:~/git/bitbucket.org/taxamo/taxamo-devops/infrastructure/opsgenie$ pulumi refresh --expect-no-changes --yes < /dev/null
[...]
Resources:
~ 1 updated
52 unchanged
Duration: 2s
error: error: no changes were expected but changes occurred
little-whale-73288
07/28/2021, 2:33 PMlittle-whale-73288
07/28/2021, 2:36 PMbored-oyster-3147
07/28/2021, 2:37 PMpulumi preview
having made no changes to your code will give you your difference between Pulumi State & Actual Statebored-oyster-3147
07/28/2021, 2:38 PMpulumi up
, than you'll be seeing the difference between your Pulumi Code & Actual State, which would be a superset of the changes between your Pulumi State & Actual Statebored-oyster-3147
07/28/2021, 2:38 PMlittle-whale-73288
07/28/2021, 2:43 PMbored-oyster-3147
07/28/2021, 2:46 PMpulumi refresh
via the CLI.bored-oyster-3147
07/28/2021, 2:47 PMpulumi refresh --preview
and then decide not to go forward with a pulumi refresh
?little-whale-73288
07/28/2021, 2:47 PMpulumi refresh --diff
is not emptylittle-whale-73288
07/28/2021, 2:48 PMlittle-whale-73288
07/28/2021, 2:49 PMbored-oyster-3147
07/28/2021, 2:49 PMbored-oyster-3147
07/28/2021, 2:50 PMlittle-whale-73288
07/28/2021, 2:52 PMbored-oyster-3147
07/28/2021, 2:52 PM--non-interactive
so it will always go right through without user input, but there still won't be a way to prevent the pulumi refresh
if there is --diff
results.bored-oyster-3147
07/28/2021, 2:53 PMpulumi refresh
if there is a diff? Why would you not want your pulumi state to be a reflection of reality? Are you trying to prevent certain resources from being created or destroyed? I'm trying to understand better to see if there is another solution.little-whale-73288
07/28/2021, 2:58 PMlittle-whale-73288
07/28/2021, 2:59 PMlittle-whale-73288
07/28/2021, 2:59 PMlittle-whale-73288
07/28/2021, 3:00 PMbored-oyster-3147
07/28/2021, 3:00 PM--expect-no-changes
would work for you. Because it would do the refresh that your operator was going to do anyway, and then it would fail your continuous deployment if there were changes so that you could address itlittle-whale-73288
07/28/2021, 3:01 PMlittle-whale-73288
07/28/2021, 3:01 PMlittle-whale-73288
07/28/2021, 3:01 PMbored-oyster-3147
07/28/2021, 3:02 PM--diff
flag then you'll be able to see your rich diff right in your CD pipeline and your operator can examine it there.little-whale-73288
07/28/2021, 3:02 PMlittle-whale-73288
07/28/2021, 3:02 PMlittle-whale-73288
07/28/2021, 3:03 PMlittle-whale-73288
07/28/2021, 3:03 PMbored-oyster-3147
07/28/2021, 3:03 PMpulumi refresh --preview
isn't currently possible so I am just making suggestions. There is nothing I can do about pulumi refresh --preview
not being currently possible.little-whale-73288
07/28/2021, 3:04 PMlittle-whale-73288
07/28/2021, 3:04 PMbored-oyster-3147
07/28/2021, 3:07 PMlittle-whale-73288
07/28/2021, 3:18 PM$ cat refresh-preview.sh
#!/bin/bash
# Workaround for <https://github.com/pulumi/pulumi/issues/1666>
# to be able to say 'no' non-interactively
nope() {
echo n | script -qfec "$(printf "%q " "$@")" /dev/null | tr -d '\r'
}
OUT="$(nope pulumi refresh --diff --color=never)"
if egrep -qx ' *~ [0-9]+ to update' <<< "$OUT"
then
echo "dirty state!"
else
echo "clean state!"
fi
$ bash refresh-preview.sh
dirty state!
$
bored-oyster-3147
07/28/2021, 3:20 PMbored-oyster-3147
07/28/2021, 3:20 PMnope
commandlittle-whale-73288
07/28/2021, 3:20 PMlittle-whale-73288
07/28/2021, 3:20 PMbored-oyster-3147
07/28/2021, 3:20 PMbored-oyster-3147
07/28/2021, 3:21 PMlittle-whale-73288
07/28/2021, 3:21 PMbored-oyster-3147
07/28/2021, 3:22 PMdirty state!
little-whale-73288
07/28/2021, 3:23 PMlittle-whale-73288
07/28/2021, 3:23 PM