How to Create Tables in Snowflake using Terraform #1003
Unanswered
sfc-gh-dkotwani
asked this question in
Q&A
Replies: 1 comment
-
This is really a problem with using the terraform fmt command incorrectly. The return code is not 0 because your HCL code is not formatted according to canonical form. If you want to format it, use the terraform fmt command with the -check option. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to create table in Snowflake using Terraform. Here is my code but the github action fails with an error:
Run terraform fmt -check
terraform fmt -check
shell: /usr/bin/bash -e {0}
env:
TERRAFORM_CLI_PATH: /home/runner/work/_temp/e9948e8a-2820-468b-98c4-63af95e3e002
/home/runner/work/_temp/e9948e8a-2820-468b-98c4-63af95e3e002/terraform-bin fmt -check
main.tf
Error: Terraform exited with code 3.
Error: Process completed with exit code 1.
Here is the code that I am using in main.tf file:
terraform {
required_providers {
snowflake = {
source = "chanzuckerberg/snowflake"
version = "0.25.17"
}
}
backend "remote" {
organization = "d-snow"
}
}
provider "snowflake" {
}
resource "snowflake_database" "demo_Terraform_db" {
name = "DEMO_TERRAFORM_DB"
comment = "Database for Snowflake Terraform demo"
}
resource "snowflake_schema" "demo_terraform_schema" {
database = snowflake_database.demo_Terraform_db.name
name = "DEMO_TERRAFORM_SCHEMA"
comment = "Schema for Snowflake Terraform demo"
}
resource "snowflake_table" "table" {
database = snowflake_schema.DEMO_TERRAFORM_SCHEMA.DEMO_TERRAFORM_DB
schema = snowflake_schema.DEMO_TERRAFORM_SCHEMA.name
name = "table"
comment = "A table."
change_tracking = false
column {
name = "id"
type = "int"
nullable = true
}
column {
name = "identity"
type = "NUMBER(38,0)"
nullable = true
}
column {
name = "data"
type = "text"
nullable = false
}
column {
name = "DATE"
type = "TIMESTAMP_NTZ(9)"
}
column {
name = "extra"
type = "VARIANT"
comment = "extra data"
}
primary_key {
name = "my_key"
keys = ["data"]
}
}
Beta Was this translation helpful? Give feedback.
All reactions