pulumi-command icon indicating copy to clipboard operation
pulumi-command copied to clipboard

Document functionality of triggers property on Command resource

Open clstokes opened this issue 3 years ago • 7 comments

Hello!

  • Vote on this issue by adding a 👍 reaction
  • If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)

Issue details

The triggers property on local.Command does not have descriptive text in the docs or in the SDK so it's not clear what is the expected behavior of this property.

screenshot-2022-02-02-12-21-04@2x

Affected area/feature

clstokes avatar Feb 02 '22 20:02 clstokes

This is available now:

Screenshot 2022-12-28 at 5 21 32 PM

lukehoban avatar Dec 29 '22 01:12 lukehoban

This isn't that helpful. what is the type expected?

I put a FileArchive and got a unrecognized signature '' in property map for "triggers" back. @lukehoban

C0DK avatar Jul 11 '23 09:07 C0DK

I used the triggers parameter like shown below. When the modification time for some_file changes, it triggers a replacement.

import os

copy_file = pulumi_command.remote.CopyFile(
    "copy_file",
    connection=connection,
    local_path="some_file",
    remote_path="/home/user/some_file",
    triggers=[
        os.path.getmtime("some_file")
    ]
)

renepetersen1984 avatar Aug 12 '23 19:08 renepetersen1984

Maybe it would make sense to write something like:

Changes to any of these values, trigger replacements as well as the types supported :) afaik it is only simple types (maybe only strings?)

C0DK avatar Aug 14 '23 07:08 C0DK

I was struggling with this as well. Re-opening to improve the docs.

thomas11 avatar May 05 '24 05:05 thomas11

@thomas11 , @C0DK , is the triggers a state/flag variable, which if changes (current-run value is different for previous-runs), the underlying action gets executed?

HandOfGod94 avatar May 06 '24 13:05 HandOfGod94

@thomas11 , @C0DK , is the triggers a state/flag variable, which if changes (current-run value is different for previous-runs), the underlying action gets executed?

Yes, exactly. It's simply an opaque value of type any/object that's checked for equality with the previous value.

thomas11 avatar May 06 '24 17:05 thomas11