pulumi / pulumi-snowflake

Apache License 2.0
17 stars 5 forks source link

Snowflake Share gets updated on every run #252

Open dmorel opened 1 year ago

dmorel commented 1 year ago

What happened?

I have this code that creates shares:

for share in SHARES:
    snowflake.Share(share["name"],
                    comment="(managed by pulumi)",
                    accounts=sorted(share["accounts"]),
                    name=share["name"])

on every run, it updates the share even though the variables don't change:

  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:prod::snowflake::pulumi:pulumi:Stack::snowflake-prod]
    ~ snowflake:index/share:Share: (update)
        [id=READER_SHARE]
        [urn=urn:pulumi:prod::snowflake::snowflake:index/share:Share::READER_SHARE]
        [provider=urn:pulumi:prod::snowflake::pulumi:providers:snowflake::default_0_23_0::9bf71816-0610-492f-a31d-e8d9c7ec9e1c]
      ~ accounts: [
          ~ [3]: "... (7 TOTAL)" => "xxxxx.READER_xxx3"
          + [4]: "xxxxx.READER_xxx4"
          + [5]: "xxxxx.READER_xxx5"
          + [6]: "xxxxx.READER_xxx6"
        ]
      + comment : "(managed by pulumi)"
Resources:
    ~ 1 to update
    206 unchanged

It looks like it's actually storing the string value (7 total) in the state file, which makes very little sense to me?

Expected Behavior

silent update when nothing is changed

Steps to reproduce

create a share with a sufficient number of accounts (I have 7) and run pulumi up.

Output of pulumi about

❯ pulumi about CLI Version 3.68.0 Go Version go1.20.4 Go Compiler gc

Plugins NAME VERSION auth0 2.20.0 aws 5.41.0 aws-apigateway 1.0.1 aws-native 0.58.0 awsx 1.0.2 datadog 4.17.1 docker 3.6.1 python unknown random 4.13.1 snowflake 0.23.0

Host OS darwin Version 13.3.1 Arch arm64

Backend Name pulumi.com URL https://app.pulumi.com/dmorel

Dependencies: NAME VERSION auth0-python 3.24.1 autopep8 2.0.2 black 22.12.0 boto3 1.26.137 coloredlogs 15.0.1 cryptography 40.0.2 flake8 6.0.0 ipython 8.13.2 mypy 1.3.0 pip 23.0.1 pulumi-auth0 2.20.0 pulumi-aws-apigateway 1.0.1 pulumi-aws-native 0.58.0 pulumi-awsx 1.0.2 pulumi-datadog 4.17.1 pulumi-random 4.13.1 pulumi-snowflake 0.23.0 pytest-playwright 0.3.3 scikit-image 0.20.0 setuptools 67.4.0 toml 0.10.2 wheel 0.38.4 yapf 0.32.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

aq17 commented 1 year ago

Hi @dmorel , thanks for opening this issue. It looks like this may be a bug in the upstream provider - as a temporary workaround, could you consider adding an ignoreChanges option to the snowflake.Share resource created in the for loop?

dmorel commented 1 year ago

Hi @aq17 that'll probably do the trick for the time being. thanks for the tip :-)