Terraform-01
Apr 15, 2022 - ⧖ 3 minI've started using Terraform to manage Snowflake infrastructure at work.
I'm still a noobie but I've got a workflow that I think makes sense...
Here's the directory setup for a simple project with some databases, schemas, and tables to manage.
terraform-dir
├── .auto.tfvars
├── databases.tf
├── main.tf
├── schemas.tf
├── tables.tf
├── .terraform
│ └── providers
│ └── registry.terraform.io
│ └── chanzuckerberg
│ └── snowflake
│ ├── 0.25.6
│ │ └── linux_amd64
│ │ ├── LICENSE
│ │ ├── README.md
│ │ └── terraform-provider-snowflake_v0.25.6
│ └── 0.31.0
│ └── linux_amd64
│ ├── CHANGELOG.md
│ ├── LICENSE
│ ├── README.md
│ └── terraform-provider-snowflake_v0.31.0
├── .terraform.lock.hcl
├── terraform.tfstate
We start with the main.tf
and I have in here providers and variables
terraform {
required_providers {
snowflake = {
source = "chanzuckerberg/snowflake"
version = "0.31.0"
}
}
}
provider "snowflake" {
// required
username = "SNOWFLAKE_USER"
account = "URL"
password = var.snowflake_password
role = "ROLE WITH DBA LIKE PERMISSIONS"
}
variable "snowflake_password" {
type = string
sensitive = true
}
variable "public" {
type = map(any)
}
variable "environment" {
type = map(any)
}
variable "roles" {
type = map(any)
}