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

After using snowflake_tag_association to set tag on account, subsequent terraform plan/apply fail with "error listing tag associations". #1910

Open
pstDnb opened this issue Jun 26, 2023 · 1 comment
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@pstDnb
Copy link

pstDnb commented Jun 26, 2023

Provider Version

0.64.0

Terraform Version

1.3.9

Describe the bug

The first attempt to set tags on the account using snowflake_tag_association succeeds. However, afterwards any attempt to run terraform plan or apply fail with error listing tag associations, because the GET_TAG function is invoked using account name (e.g SANDPIT01_AWS_EW1_DEV instead of account locator (e.g. KP44023).

Example of failing SQL query:

SELECT SYSTEM$GET_TAG('"LIBRARY_FEATURE_PAALDEV"."TAGS"."ACCOUNT_TYPE"', '"SANDPIT01_AWS_EW1_DEV"', 'ACCOUNT') TAG_VALUE WHERE TAG_VALUE IS NOT NULL;

The above query succeeds if SANDPIT01_AWS_EW1_DEV is replaced with KP44023.

It is not an option to use account locator in object_identifier, since the SQL generated to set the tag explicitly mentions the account:

ALTER ACCOUNT "SANDPIT01_AWS_EW1_DEV" SET TAG "LIBRARY_FEATURE_PAALDEV"."TAGS"."ACCOUNT_GROUP" = 'SANDPIT01';

(The Snowflake documentation specifies a syntax without account name for 'ALTER ACCOUNT SET TAG', and even though it works
with account name, the same query fails when replacing account name with account locator.)

Expected behavior

When listing tag associations on the account (during plan or apply), the provider should use a query that correctly retrieves the tag.

Code samples and commands

Please add code examples and commands that were run to cause the problem.

Additional context

Add any other context about the problem here.

@pstDnb pstDnb added the bug Used to mark issues with provider's incorrect behavior label Jun 26, 2023
@sfc-gh-swinkler
Copy link
Collaborator

sfc-gh-swinkler commented Jul 25, 2023

@pstDnb thank you for reporting this issue. We will look into it and get back to you. Also, I think this ticket is related to #1926 . What we will need to do is refactor the snowflake_tag_association resource, as it does not seem to handle identifiers well in every situation.

sfc-gh-asawicki added a commit that referenced this issue Mar 5, 2024
fixes:
#1926 
#1910
#1909 
#1202

---------

Co-authored-by: Artur Sawicki <artur.sawicki@snowflake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior
Projects
None yet
Development

No branches or pull requests

2 participants