pulumi-command
pulumi-command copied to clipboard
trigger update feature
Currently the trigger option for the local.Command function does not allow for triggering a resource update. This will alway trigger a replacement.
https://www.pulumi.com/registry/packages/command/api-docs/local/command/#inputs
I would like the expected functionality of a value change to trigger a non-destructive update in addition to the existing functionality where a value change triggers a replacement.
Hi @Caleb-Servian , could you provide a repro of your issue? Curious as to how this may be impacting your program, since functionally a replace should be the same as an update.
@AaronFriel the scenario I have is the deployment of an API proxy using CLI commands.
In an update scenario either update will be run, or if not specified then create will be run.
For my use case this means that my create command which does a seamless redeploy of a new version will run
i.e.
create=pulumi.Output.all(name=self.api_proxy.name, \
rev=self.api_proxy.revision, token=self.token, \
org=self.organization_id).apply(
lambda args: f"apigeecli apis deploy \
-o {args['org']} \
-n {args['name']} \
-v {args['rev'][-1]} \
-e {self.env_name} \
-t {args['token']} \
-r"),
However, from the above command I need to ignore token changes from create/delete which is a shortlived auth token.
and so must leverage triggers on proxy revision
opts=pulumi.ResourceOptions(
ignore_changes=["create", "delete"]
),
triggers=[self.api_proxy_revision]
In a replace scenario default behavior is create/delete where the seamless redeploy occurs, and then an undeploy occurs and I am left with no proxy.
If I override the default behaviour with delete_before_replace then the proxy is undeployed and then redeployed which results in downtime for the API proxy which is undesirable.
I have currently resolved my issue by using another command which can leverage environment vars to pass the token value, and so I am not required to use triggers right now, though this still seems to me like worthwhile functionality.
environment={'CLOUDSDK_AUTH_ACCESS_TOKEN': token},
create=pulumi.Output.format("gcloud apigee apis deploy {0} --organization={1} --environment={2} --api={3} --override",
revision,
self.organization_id,
self.env_name,
self.api_proxy_name),
opts=pulumi.ResourceOptions(
ignore_changes=["environment"],
)
With further testing I found the above did not work and I instead had to set 'CLOUDSDK_AUTH_ACCESS_TOKEN' in the CICD pipeline and not leverage environment at all
create=pulumi.Output.format("gcloud apigee apis deploy {0} --organization={1} --environment={2} --api={3} --override",
revision,
self.organization_id,
self.env_name,
self.api_proxy_name),