https://pulumi.com logo
#google-cloud
Title
# google-cloud
t

thousands-knife-3009

03/21/2024, 7:15 PM
what's the trick to not recreating resources just because the provider version is updated?
b

brash-monkey-31522

03/21/2024, 8:26 PM
do a
pulumi up --target <provider-urn>
t

thousands-knife-3009

03/21/2024, 8:30 PM
@brash-monkey-31522 can you elaborate on that? Does that just lock you in to use a single provider version?
from what i'm reading, that will tell pulumi to only update the specified provider.
b

brash-monkey-31522

03/21/2024, 8:55 PM
Does that just lock you in to use a single provider version?
No, it just updates the one resource like you said
t

thousands-knife-3009

03/21/2024, 8:56 PM
ok. i still want to update all of my resources but i don't want resources to be deleted and recreated just because a provider updated their versioning. surely i'm missing something about the concept of pulumi. it seems i can either lock in to a specific version OR certain resources get deleted and recreated when there's a new release here https://github.com/pulumi/pulumi-gcp/releases
b

brash-monkey-31522

03/21/2024, 8:57 PM
You shouldn’t need to update your resources when you update the provider, the resources already exist in GCP and any API change on gcp’s side will be automatically applied to your resources.
ex if they add a new field, then that field will be added with a default value to your resource in GCP, the provider update is just to support managing that new field.
t

thousands-knife-3009

03/21/2024, 8:58 PM
[provider: urnpulumimain:redacted pulumipulumiprovidersgcpdefault 7 13 0:22a434da-6115-44e7-b085-dc962c2d0b6a => urnpulumimain:redacted pulumipulumiprovidersgcpdefault 7 14 0:output<string>]
b

brash-monkey-31522

03/21/2024, 8:58 PM
The exception being breaking changes in the provider, in which case you need to read the changelog for that version change
t

thousands-knife-3009

03/21/2024, 9:00 PM
nothing in that changelog about breaking changes
v7.14.0 Changelog 6918cf0 Remove gcp creds from state (#1814) 452bcce Upgrade pulumi-terraform-bridge to v3.77.0 (#1813) 62d279c Upgrade terraform provider google beta to v5.20.0 (#1824)
b

brash-monkey-31522

03/21/2024, 9:04 PM
What is the current provider version you are using?
oh nvm I see it 7.13
then yeah, i would do as I initially described, a
pulumi up
targeting only the provider resource
t

thousands-knife-3009

03/21/2024, 9:23 PM
so, does everyone just lock in to a single provider version forever? that doesn't seem right. it doesn't make sense to recreate your infrastructure just to get updates on a provider.
b

brash-monkey-31522

03/21/2024, 9:24 PM
You aren’t locking into a provider version
Pulumi just isn’t smart enough to decide on each provider update if it needs to change resources, so it defaults to replacing every resource
The targeted pulumi up will make any API calls after use the updated version of the provider
t

thousands-knife-3009

03/21/2024, 9:32 PM
so, you're saying i need to specify the 7.13 version as the target going forward?
b

brash-monkey-31522

03/21/2024, 9:38 PM
no
pulumi up --target <provider-urn>
this will update your provider to the version you have installed in your language’s dependency manager
so 7.14 in this case
once you run
pulumi up --target <provider-urn>
you can do
pulumi preview
and you’ll see there are no resources to be replaced, life is good, you have updated the provider, congrats
t

thousands-knife-3009

03/21/2024, 9:41 PM
isn't this the result the of updating the provider? "[provider: urnpulumimain:redacted pulumipulumiprovidersgcpdefault 7 13 0:22a434da-6115-44e7-b085-dc962c2d0b6a => urnpulumimain:redacted pulumipulumiprovidersgcpdefault 7 14 0:output<string>]"
when the resource was initially created, it was done using the 7.13 provider. then on this update, it's using the 7.14 provider and since the provider version is part of the resource urn, it replaces the resource. right?
b

brash-monkey-31522

03/21/2024, 9:43 PM
> it replaces the resource. right? yes, but it doesn’t have to, pulumi just isn’t able to understand that
t

thousands-knife-3009

03/21/2024, 9:45 PM
does it hurt anything to keep the
--target <provider-urn>
part in my pulumi up command and have it always run? i ask because my pulumi commands are all in ci/cd pipelines and not executed locally on developer systems.
also, what about when you have multiple providers? should i specify each provider as a target to prevent this issue with them?
b

brash-monkey-31522

03/21/2024, 9:48 PM
you only need to do the target once
also, what about when you have multiple providers? should i specify each provider as a target to prevent this issue with them?
only if you see the replace issue
t

thousands-knife-3009

03/21/2024, 9:49 PM
how do you manage this with ci/cd?
b

brash-monkey-31522

03/21/2024, 9:50 PM
I don’t 😛
t

thousands-knife-3009

03/21/2024, 9:50 PM
the more i learn, the more i think pulumi was designed to be ran from your local computer 99.9% of the time
b

brash-monkey-31522

03/21/2024, 9:50 PM
Yeah, same. I haven’t bothered trying to CI/CDify my pulumi stack
t

thousands-knife-3009

03/21/2024, 9:51 PM
this makes me want to nuke my infra from orbit and go back to terraform. (which pulumi seems to be using all the integrations from anyways)
2 Views