Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger update feature #189

Open
Caleb-Servian opened this issue Mar 16, 2023 · 2 comments
Open

trigger update feature #189

Caleb-Servian opened this issue Mar 16, 2023 · 2 comments
Labels
kind/enhancement Improvements or new features

Comments

@Caleb-Servian
Copy link

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.

@aq17
Copy link

aq17 commented Mar 17, 2023

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 AaronFriel added awaiting-feedback Blocked on input from the author and removed awaiting-feedback labels Mar 17, 2023
@Caleb-Servian
Copy link
Author

Caleb-Servian commented Mar 19, 2023

@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),

@mnlumi mnlumi added kind/enhancement Improvements or new features and removed awaiting-feedback Blocked on input from the author labels Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

4 participants