Snowflake-Labs / terraform-provider-snowflake

Terraform provider for managing Snowflake accounts
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest
MIT License
552 stars 420 forks source link

[Bug]: Issue with READER Managed Account after activating the 2024_08_bundle #3161

Open betclicadri opened 3 weeks ago

betclicadri commented 3 weeks ago

Terraform CLI Version

1.6

Terraform Provider Version

0.70.1

Terraform Configuration

Hello,

I am reaching out to report an issue encountered with a READER Managed Account following the activation of the [2024_08_bundle](https://docs.snowflake.com/en/release-notes/bcr-bundles/2024_08_bundle).

I observed an unexpected behavior during the terraform apply of the "snowflake_managed_account" resource type.

After the apply, the following error appears :

"""
error dropping this does not seem to be used err = 002003 (02000): SQL compilation error: Managed account '""' does not exist or not authorized.
"""

After this update, we observed that the Terraform state did not properly update certain attributes, particularly the "locator", "name", and "url" fields, which are now empty strings.

It appears that Snowflake has renamed the columns NAME, LOCATOR, and URL, and I suspect that the Terraform version we are using is unable to locate these columns with the new naming.
See the bottom of the following doc for the renaming: https://docs.snowflake.com/en/release-notes/bcr-bundles/2024_08/bcr-1738

Indeed,

Could you let us know which upcoming Snowflake provider version in Terraform will be compatible with the 2024_08 bundle?

See the bottom of the following doc for the renaming: https://docs.snowflake.com/en/release-notes/bcr-bundles/2024_08/bcr-1738

Category

category:resource

Object type(s)

resource:managed_account

Expected Behavior

"locator", "name", "url" fields are not empty in tf state.

Actual Behavior

"locator", "name", "url" fields are empty in tf state.

Steps to Reproduce

  1. Create resource "snowflake_managed_account" (as reader account) with terraform apply:
resource "snowflake_managed_account" "my_reader_account" {
  name           = "name_of_the_reader_account"
  admin_name     = "admin_name"
  admin_password = "admin_password"
  type           = "READER"
  comment        = "some comment"
}
  1. Activate the 2024_08 bundle on Snowflake: SYSTEM$ENABLE_BEHAVIOR_CHANGE_BUNDLE('2024_08')

  2. Do a tf apply

How much impact is this issue causing?

Low

Logs

No response

Additional Information

tf state:

Would you like to implement a fix?

sfc-gh-jcieslak commented 3 weeks ago

Hey @betclicadri I can see you are pretty far behind with the current terraform provider version. I highly advise migrating toward the latest version, because we are soon planning on releasing v1 (see the announcement). Currently, the provider doesn't apply changes added in 2024_08, so you cannot use the resource with the bundle turned on. If that's possible for the time being, disable the bundle. We will be adjusting the account (and managed account) resource soon, but those adjustments won't be propagated to the older versions, meaning it will be only usable in the latest version of the provider. This will change after V1 where we are planning to do adjustments for older post-V1 versions, so changes such as Snowflake BCRs will be fixed (that's why I'm recommending to upgrade to the latest versions where it will be easier to migrate to v1). But, tldr; Soon, we'll be working on account object where we'll adjust it. For now, disable the bundle or use the unsafe_execute resource.

Edit: I just checked that we separated the tasks for account and managed account resources, so managed accounts will be done after v1.