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

Snowflake Account is created thru terraform- but displaying error message after completing the terraform job #2015

Open
maheshrepala opened this issue Aug 16, 2023 · 3 comments
Labels
bug Used to mark issues with provider's incorrect behavior category:resource resource:account Issue connected to the snowflake_account resource

Comments

@maheshrepala
Copy link

maheshrepala commented Aug 16, 2023

Provider Version
0.67 and 0.69 both have been tried
The provider version you are using.

Terraform Version

The version of Terraform you were using when the bug was encountered.

Describe the bug
Snowflake Account is created thru terraform- but displaying error message after completing the terraform job

Error Message:
Object does not exist or not authorized

A clear and concise description of what the bug is.

Snowflake account is created in the organization- terraform job is displaying the error message even though the account is successfully created.

Expected behavior
Error message should not appear
A clear and concise description of what you expected to happen.

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.

@maheshrepala maheshrepala added the bug Used to mark issues with provider's incorrect behavior label Aug 16, 2023
@kushal1313
Copy link

Provider version
0.70.0
Terraform Version
Terraform v1.4.6
Describe the bug
Snowflake Account is created thru terraform- but displaying error message after completing the terraform job

Error Message:
Object does not exist or not authorized

A clear and concise description of what the bug is.

Snowflake account is created in the organization- terraform job is displaying the error message even though the account is successfully created.

Expected behavior
Error message should not appear
A clear and concise description of what you expected to happen.

Code samples and commands

terraform {
required_providers {
snowflake = {
source = "Snowflake-Labs/snowflake"
version = "~> 0.70.0"
}
}
}
provider "snowflake" {
account = "youraccountname"
username = "yourorgadminuser"
password = "********"
role = "ORGADMIN"
}

resource "snowflake_account" "ac1" {
name = "SFaccountname"
admin_name = "username"
admin_password = "***"
email = "[email protected]"
first_name = "fname"
last_name = "lname"
must_change_password = false
edition = "STANDARD"
comment = "Snowflake Test Account"
region = "AWS_US_EAST_1"
}

@bogdan-cioata
Copy link

I encounter the same issue as above ☝️

Provider Version

0.68.2

Terraform Version

1.6.1

Describe the bug
Account creation fails through Terraform, but succeeds under the hood.

Expected behavior

The account should be tracked in the state.

Code samples and commands

locals {
  domains = {
    aaa = {
      name    = "AAAA"
      edition = "ENTERPRISE"
      region  = "aws_us_east_2"
      owner = {
        first_name = "<redacted>"
        last_name  = "<redacted>"
        username   = "<redacted>"
        email      = "<redacted>"
      }
    }
  }
}

resource "snowflake_account" "domain" {
  for_each = local.domains

  name    = upper(each.value.name)
  edition = upper(each.value.edition)
  region  = upper(each.value.region)

  admin_name           = upper(each.value.owner.username)
  admin_password       = "<redacted>"
  must_change_password = true
  email                = each.value.owner.email
  first_name           = each.value.owner.first_name
  last_name            = each.value.owner.last_name

  provider = snowflake.orgadmin
}

terraform init & apply fails with:

snowflake_account.domain["aaa"]: Creating...
╷
│ Error: object does not exist or not authorized
│ 
│   with snowflake_account.domain["aaa"],
│   on main.tf line 17, in resource "snowflake_account" "domain":
│   17: resource "snowflake_account" "domain" {
│ 

Additional context
Although the error is thrown, an account gets successfully created under the Snowflake organization.
image

Re-running terraform apply throws:

│ Error: 003723 (XX000): Account with name 'AAAA' already exists in the organization.
│ 
│   with snowflake_account.domain["aaa"],
│   on main.tf line 17, in resource "snowflake_account" "domain":
│   17: resource "snowflake_account" "domain" {

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

Hello 👋
Recently, we released v0.100.0 and v1.0.0 that contains reworked account resource. The issue should not happen there, please migrate with the use of migration guide and let us know if the issue can be closed. 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:account Issue connected to the snowflake_account resource
Projects
None yet
Development

No branches or pull requests

4 participants