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

Ignore edition check does not work as expected #1453

Closed
brandocomando opened this issue Jan 4, 2023 · 4 comments
Closed

Ignore edition check does not work as expected #1453

brandocomando opened this issue Jan 4, 2023 · 4 comments
Assignees
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:database Issue connected to the snowflake_database resource

Comments

@brandocomando
Copy link

Provider Version

0.54.0

Terraform Version

1.3.6

Describe the bug

Unable to add replication from A business critical account to a non business critical account even with ignore_edition_check = true

Expected behavior

Able to create database that can be replicated if ignore_edition_check = true

Code samples and commands

error:

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.platform.snowflake_database.mytestdb will be updated in-place
  ~ resource "snowflake_database" "mytestdb" {
        id                          = "MY_TEST_DB"
        name                        = "MY_TEST_DB"
        # (2 unchanged attributes hidden)

      + replication_configuration {
          + accounts             = [
              + "MY_ORG_ID.MY_SECONDARY_ACCOUNT",
            ]
          + ignore_edition_check = true
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: 
module.platform.snowflake_database.mytestdb: Modifying... [id=MY_TEST_DB]
╷
│ Error: error enabling replication configuration with statement ALTER DATABASE "MY_TEST_DB" ENABLE REPLICATION TO ACCOUNTS MY_ORG_ID.MY_SECONDARY_ACCOUNT err = 003537 (23001): SQL execution error: Replication is not allowed from an account on BUSINESS CRITICAL edition to an account on a lower edition. 
│ The following account(s) are on editions lower than BUSINESS CRITICAL: [PUBLIC.AWS_EU_WEST_1.MY_SECONDARY_ACCOUNT]
│ You can override this check for this database.
│ Before overriding this check, confirm that the target account has appropriate security controls and is compliant for the data being replicated.
│ 
│ To override this check for this database, run
│ alter database <database_name> enable replication to <accounts> ignore edition check
│ 
│   with module.platform.snowflake_database.mytestdb,
│   on ../modules/platform/databases.tf line 102, in resource "snowflake_database" "mytestdb":
│  102: resource "snowflake_database" "mytestdb" {
│ 
@brandocomando brandocomando added the bug Used to mark issues with provider's incorrect behavior label Jan 4, 2023
@brandocomando
Copy link
Author

I'm no golang expert, but the error seems to indicate that it is not passing the ignore edition check in the statement. and the function:

func (db *DatabaseBuilder) EnableReplicationAccounts(dbName string, accounts string) string {
	return fmt.Sprintf(`ALTER DATABASE "%v" ENABLE REPLICATION TO ACCOUNTS %v`, dbName, accounts)
}

also has no reference to the ignore edition check. havent been able to track down how it should make it to this function tho.

@brandocomando
Copy link
Author

@sfc-gh-jalin Looks like you were the one who last updated the db replication pieces. Are you able to take a look at this?

@sfc-gh-jcieslak sfc-gh-jcieslak added category:resource resource:database Issue connected to the snowflake_database resource labels May 20, 2024
@sfc-gh-jcieslak
Copy link
Collaborator

Hey @brandocomando 👋
I'm currently working on databases as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#preparing-essential-ga-objects-for-the-provider-v1. I reproduced your configuration and this issue shouldn't happen in later versions of the provider. If you can, please try the latest one (or one of the latest) and let me know if that works for you. In case of any issues with upgrading, check our migration guide (it may be lacking in information for early versions).

@sfc-gh-jcieslak sfc-gh-jcieslak self-assigned this Jun 7, 2024
@brandocomando
Copy link
Author

thank you!

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 category:resource resource:database Issue connected to the snowflake_database resource
Projects
None yet
Development

No branches or pull requests

2 participants