Coder Social home page Coder Social logo

This is a bug in the provider, which should be reported in the provider's own issue tracker. about terraform-provider-snowflake HOT 5 OPEN

KrishnaVishwakarma27101999 avatar KrishnaVishwakarma27101999 commented on September 1, 2024
This is a bug in the provider, which should be reported in the provider's own issue tracker.

from terraform-provider-snowflake.

Comments (5)

sfc-gh-jcieslak avatar sfc-gh-jcieslak commented on September 1, 2024

Hey @KrishnaVishwakarma27101999 👋
It looks like the plugin created a database, but then couldn't retrieve it after it was created. Terraform essentially ran:

CREATE DATABASE "new_database_ts";
SHOW DATABASES LIKE 'new_database_ts';

Could you try to manually run those with the Terraform account and see if the database is returned by SHOW command?
We couldn't reproduce the error on our side, so could you provide the exact steps on how to reproduce this issue?

from terraform-provider-snowflake.

KrishnaVishwakarma27101999 avatar KrishnaVishwakarma27101999 commented on September 1, 2024

I am new to terraform
Its very difficult to explain. If you want, I can share the snowflake dummy account details where I was testing the Terraform.

Screenshot 2024-02-29 at 4 24 10 PM

main.tf

terraform {
required_providers {
snowflake = {
source = "Snowflake-Labs/snowflake"
version = "~> 0.76"

}

}
}

provider "snowflake" {
*the Snowflake account identifier

}

resource "snowflake_database" "db" {
name = "new_database_ts"

}

data "snowflake_databases" "this" {

}

output "password" {
sensitive = true
value = data.snowflake_databases.this
}

tfstate file.
{
"version": 4,
"terraform_version": "1.7.4",
"serial": 16,
"lineage": "91a31be1-6cc9-e8e4-7be1-c0a4128585a0",
"outputs": {
"password": {
"value": {
"databases": [
{
"comment": "",
"created_on": "2024-02-29 06:44:09.403 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "NEW_DATABASE_TS",
"options": "",
"origin": "",
"owner": "ACCOUNTADMIN",
"replication_configuration": [],
"retention_time": 1
},
{
"comment": "",
"created_on": "2024-02-14 11:07:05.669 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "SNOWFLAKE",
"options": "",
"origin": "SNOWFLAKE.ACCOUNT_USAGE",
"owner": "",
"replication_configuration": [],
"retention_time": 0
},
{
"comment": "Provided by Snowflake during account provisioning",
"created_on": "2024-02-14 11:07:09.857 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "SNOWFLAKE_SAMPLE_DATA",
"options": "",
"origin": "SFSALESSHARED.SFC_SAMPLES_AWS_AP_SOUTH_1.SAMPLE_DATA",
"owner": "ACCOUNTADMIN",
"replication_configuration": [],
"retention_time": 0
}
],
"history": false,
"id": "databases_read",
"pattern": null,
"starts_with": null,
"terse": false
},
"type": [
"object",
{
"databases": [
"list",
[
"object",
{
"comment": "string",
"created_on": "string",
"is_current": "bool",
"is_default": "bool",
"name": "string",
"options": "string",
"origin": "string",
"owner": "string",
"replication_configuration": [
"list",
[
"object",
{
"accounts": [
"list",
"string"
],
"ignore_edition_check": "bool"
}
]
],
"retention_time": "number"
}
]
],
"history": "bool",
"id": "string",
"pattern": "string",
"starts_with": "string",
"terse": "bool"
}
],
"sensitive": true
}
},
"resources": [
{
"mode": "data",
"type": "snowflake_databases",
"name": "this",
"provider": "provider["registry.terraform.io/snowflake-labs/snowflake"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"databases": [
{
"comment": "",
"created_on": "2024-02-29 06:44:09.403 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "NEW_DATABASE_TS",
"options": "",
"origin": "",
"owner": "ACCOUNTADMIN",
"replication_configuration": [],
"retention_time": 1
},
{
"comment": "",
"created_on": "2024-02-14 11:07:05.669 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "SNOWFLAKE",
"options": "",
"origin": "SNOWFLAKE.ACCOUNT_USAGE",
"owner": "",
"replication_configuration": [],
"retention_time": 0
},
{
"comment": "Provided by Snowflake during account provisioning",
"created_on": "2024-02-14 11:07:09.857 +0000 UTC",
"is_current": false,
"is_default": false,
"name": "SNOWFLAKE_SAMPLE_DATA",
"options": "",
"origin": "SFSALESSHARED.SFC_SAMPLES_AWS_AP_SOUTH_1.SAMPLE_DATA",
"owner": "ACCOUNTADMIN",
"replication_configuration": [],
"retention_time": 0
}
],
"history": false,
"id": "databases_read",
"pattern": null,
"starts_with": null,
"terse": false
},
"sensitive_attributes": []
}
]
}
],
"check_results": null
}

from terraform-provider-snowflake.

sfc-gh-jcieslak avatar sfc-gh-jcieslak commented on September 1, 2024

@KrishnaVishwakarma27101999 If you ran those commands manually

CREATE DATABASE "new_database_ts";
SHOW DATABASES LIKE 'new_database_ts';

It means you created the database in Snowflake and Terraform won't know about the existence of this database and will throw an error that Object "new_database_ts" already exists, because it wants to create one but it already exists. To come back to the previous state of Snowflake remove the manually created database with:

DROP DATABASE "new_database_ts";

After that you shouldn't get the already exists error when running terraform plan or terraform apply, but you should see the original one.

I don't think there's anything wrong with the Snowflake provider when executing the config you posted:

resource "snowflake_database" "db" {
  name = "new_database_ts"
}

We tested this example in different ways, but couldn't get the error you've got. Unfortunately, we cannot help without being able to reproduce your error. As far as I can tell from the logs you provided, It seems like the database got created and SHOW DATABASE was run, but no database was found for some reason. As I proposed I can recommend you running this:

CREATE DATABASE "new_database_ts";
SHOW DATABASES LIKE 'new_database_ts';

and please post the result of SHOW DATABASES command. Important thing is to use the same account you're using for Terraform so it will have the same privileges.

from terraform-provider-snowflake.

KrishnaVishwakarma27101999 avatar KrishnaVishwakarma27101999 commented on September 1, 2024

Hi is there any chance we can connect over the meet

from terraform-provider-snowflake.

sfc-gh-jcieslak avatar sfc-gh-jcieslak commented on September 1, 2024

Hey @KrishnaVishwakarma27101999 👋
Please contact your account team at Snowflake for the quickest response. The Product and Engineering teams are available for issues that cannot be resolved by the account team and documentation.

from terraform-provider-snowflake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.