Comments (5)
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.
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](https://private-user-images.githubusercontent.com/54256061/308895904-05d69985-7733-4509-abd5-6aec0d9e1f9b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTA1MTYxNDIsIm5iZiI6MTcxMDUxNTg0MiwicGF0aCI6Ii81NDI1NjA2MS8zMDg4OTU5MDQtMDVkNjk5ODUtNzczMy00NTA5LWFiZDUtNmFlYzBkOWUxZjliLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDAzMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwMzE1VDE1MTcyMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWQ1NjZiY2FkMjdiMjUyYjBmOWIxZmZmOGEyNDVlMzVkNTJiN2MxM2M2NzU0MWRkMzcyMzExMGFkNzg1OTRkY2QmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.snYX_IHZLvU4M5PXjIkUSYyq3VrJKWqCunaYN8MQz3U)
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.
@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.
Hi is there any chance we can connect over the meet
from terraform-provider-snowflake.
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)
- Cannot delete snowflake_network_policy_attachment resource HOT 1
- Cannot create a stream in Terraform HOT 4
- Error upgrading from snowflake_grant_privileges_to_role to snowflake_grant_privileges_to_account_role HOT 3
- pipe creation error with "object does not exist or not authorized" dependent from External Stage that seems not to be fully available HOT 1
- Provider tries to set column collation when changing numeric types. HOT 4
- Add START WITH optional value to Sequence Resource HOT 2
- CREATE DATABASE FROM SHARE failing with "SQL compilation error: Share .. does not exist or not authorized." HOT 2
- Network Policy SDK update HOT 4
- Importing snowflake_grant_account_role resources fails HOT 2
- Add support for tagging Snowflake Alert HOT 3
- [Docs]: New deprecated message may be wrong. HOT 4
- snowflake_schema errors when comment is changed to null (empty string) HOT 1
- grant_privileges_to_account_role Unsupported privilege 'OWNERSHIP' HOT 2
- Grant ownership on database role HOT 3
- `snowflake_grant_privileges_to_share` revokes grants without reason HOT 2
- snowflake_grant_privileges_to_account_role quote escapes are not consistent when using import HOT 10
- Terraform state file error - Error: error retrieving grants for account role: [errors.go:17] object does not exist or not authorized HOT 2
- Guidance for migrating grants to snowflake_grant_privileges_to_account_role that have multiple roles? HOT 4
- Add support for optional / default arguments for snowflake_procedure resources HOT 2
- Allow configuring `storage_aws_external_id` for `snowflake_storage_integration` HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terraform-provider-snowflake.