All Projects → chanzuckerberg → Terraform Provider Snowflake

chanzuckerberg / Terraform Provider Snowflake

Licence: mit
Terraform provider for managing Snowflake accounts

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Terraform Provider Snowflake

Tfmask
Terraform utility to mask select output from `terraform plan` and `terraform apply`
Stars: ✭ 148 (-10.3%)
Mutual labels:  terraform
Terraform Inventory
An Ansible dynamic inventory script to pair with nbering/terraform-provider-ansible.
Stars: ✭ 154 (-6.67%)
Mutual labels:  terraform
Terraform Kubernetes Installer
Terraform Installer for Kubernetes on Oracle Cloud Infrastructure
Stars: ✭ 162 (-1.82%)
Mutual labels:  terraform
Multiregion Terraform
Example multi-region AWS Terraform application
Stars: ✭ 149 (-9.7%)
Mutual labels:  terraform
Infrastructure As Code Tutorial
Infrastructure As Code Tutorial. Covers Packer, Terraform, Ansible, Vagrant, Docker, Docker Compose, Kubernetes
Stars: ✭ 1,954 (+1084.24%)
Mutual labels:  terraform
Terraform Aws Kubernetes
Terraform module for Kubernetes setup on AWS
Stars: ✭ 159 (-3.64%)
Mutual labels:  terraform
Py Az2tf
Tool to automatically generate Terraform files for your Azure subscription
Stars: ✭ 148 (-10.3%)
Mutual labels:  terraform
Terraform Aws Cloudfront S3 Cdn
Terraform module to easily provision CloudFront CDN backed by an S3 origin
Stars: ✭ 162 (-1.82%)
Mutual labels:  terraform
Aws Labs
step by step guide for aws mini labs. Currently maintained on : https://github.com/Cloud-Yeti/aws-labs Youtube playlist for labs:
Stars: ✭ 153 (-7.27%)
Mutual labels:  terraform
Terrible
An Ansible playbook that apply the principle of the Infrastructure as Code on a QEMU/KVM environment.
Stars: ✭ 161 (-2.42%)
Mutual labels:  terraform
Terraform Aws Eks
Terraform module to create an Elastic Kubernetes (EKS) cluster and associated worker instances on AWS
Stars: ✭ 2,464 (+1393.33%)
Mutual labels:  terraform
Terraform Kubernetes
Example of deploying a Kubernetes cluster to Google Cloud using Terraform
Stars: ✭ 152 (-7.88%)
Mutual labels:  terraform
Terraform Aws Devops
Info about many of my Terraform, AWS, and DevOps projects.
Stars: ✭ 159 (-3.64%)
Mutual labels:  terraform
Terrahub
Terraform Automation and Orchestration Tool (Open Source)
Stars: ✭ 148 (-10.3%)
Mutual labels:  terraform
Terraform Docs
Generate documentation from Terraform modules in various output formats
Stars: ✭ 2,483 (+1404.85%)
Mutual labels:  terraform
Terraform.tmlanguage
Terraform (HCL) configuration file syntax highlighting for Sublime Text 2 and 3
Stars: ✭ 148 (-10.3%)
Mutual labels:  terraform
Yuniql
Free and open source schema versioning and database migration made natively with .NET Core.
Stars: ✭ 156 (-5.45%)
Mutual labels:  snowflake
Terraform Provider Lxd
LXD Resource provider for Terraform
Stars: ✭ 164 (-0.61%)
Mutual labels:  terraform
Vscode
Connect to MongoDB and Atlas and directly from your VS Code environment, navigate your databases and collections, inspect your schema and use playgrounds to prototype queries and aggregations.
Stars: ✭ 161 (-2.42%)
Mutual labels:  terraform
Tecli
In a world where everything is Terraform, teams use Terraform Cloud API to manage their workloads. TECLI increases teams productivity by facilitating such interaction and by providing easy commands that can be executed on a terminal or on CI/CD systems.
Stars: ✭ 158 (-4.24%)
Mutual labels:  terraform

Terraform Provider: Snowflake

Please note: If you believe you have found a security issue, please responsibly disclose by contacting us at [email protected].


.github/workflows/ci.yml

This is a terraform provider plugin for managing Snowflake accounts.

Getting Help

If you need help, try the discussions area of this repo.

Install

The easiest way is to run this command:

curl https://raw.githubusercontent.com/chanzuckerberg/terraform-provider-snowflake/main/download.sh | bash -s -- -b $HOME/.terraform.d/plugins

Note that this will only work with recent releases, for older releases, use the version of download.sh that corresponds to that release (replace main in that curl with the version).

It runs a script generated by godownloader which installs into the proper directory for terraform (~/.terraform.d/plugins).

You can also just download a binary from our releases and follow the Terraform directions for installing 3rd party plugins.

For Terraform v0.13+ users

You can use Explicit Provider Source Locations.

The following maybe work well.

terraform {
  required_providers {
    snowflake = {
      source = "chanzuckerberg/snowflake"
      version = "0.20.0"
    }
  }
}

Usage

An introductory tutorial is available from Snowflake.

In-depth docs are available on the Terraform registry.

Development

If you do not have Go installed:

  1. Install Go brew install golang

  2. Make a Go development directory wherever you like mkdir go_projects

  3. Add the following config to your profile

    export GOPATH=$HOME/../go_projects # edit with your go_projects dir
    export PATH=$PATH:$GOPATH/bin
    
  4. Fork this repo and clone it into go_projects

  5. cd to terraform-provider-snowflake and install all the required packages with make setup

  6. Finally install goimports with (cd && go get golang.org/x/tools/cmd/goimports).

  7. You should now be able to successfully run the tests with make test

It has not been tested on Windows, so if you find problems let us know.

If you want to build and test the provider locally there is a make target make install-tf that will build the provider binary and install it in a location that terraform can find.

Testing

Note: PRs for new resources will not be accepted without passing acceptance tests.

For the Terraform resources, there are 3 levels of testing - internal, unit and acceptance tests.

The 'internal' tests are run in the github.com/chanzuckerberg/terraform-provider-snowflake/pkg/resources package so that they can test functions that are not exported. These tests are intended to be limited to unit tests for simple functions.

The 'unit' tests are run in github.com/chanzuckerberg/terraform-provider-snowflake/pkg/resources_test, so they only have access to the exported methods of resources. These tests exercise the CRUD methods that on the terraform resources. Note that all tests here make use of database mocking and are run locally. This means the tests are fast, but are liable to be wrong in subtle ways (since the mocks are unlikely to be perfect).

You can run these first two sets of tests with make test.

The 'acceptance' tests run the full stack, creating, modifying and destroying resources in a live snowflake account. To run them you need a snowflake account and the proper authentication set up. These tests are slower but have higher fidelity.

To run all tests, including the acceptance tests, run make test-acceptance.

Pull Request CI

Our CI jobs run the full acceptence test suite, which involves creating and destroying resources in a live snowflake account. Github Actions is configured with environment variables to authenticate to our test snowflake account. For security reasons, those variables are not available to forks of this repo.

If you are making a PR from a forked repo, you can create a new Snowflake trial account and set up Travis to build it by setting these environement variables:

  • SNOWFLAKE_ACCOUNT - The account name
  • SNOWFLAKE_USER - A snowflake user for running tests.
  • SNOWFLAKE_PASSWORD - Password for that user.
  • SNOWFLAKE_ROLE - Needs to be ACCOUNTADMIN or similar.
  • SNOWFLAKE_REGION - Default is us-west-2, set this if your snowflake account is in a different region.

If you are using the Standard Snowflake plan, it's recommended you also set up the following environment variables to skip tests for features not enabled for it:

  • SKIP_DATABASE_TESTS - to skip tests with retention time larger than 1 day
  • SKIP_WAREHOUSE_TESTS - to skip tests with multi warehouses

Releasing

Running a release

Note: releases can only be done by those with keybase pgp keys allowed in the terraform registry.

Releases are done by goreleaser and run by our make files. There two goreleaser configs, .goreleaser.yml for regular releases and .goreleaser.prerelease.yml for doing prereleases (for testing).

Releases are published to the terraform registry, which requires that releases by signed.

Adding a new releaser

To set up a new person for releasing, there are a few steps–

  1. releaser: a keybase account and a workstation set up with their Keybase app.
  2. releaser: a pgp key - keybase pgp gen
  3. releaser: export public key.
    1. If you have a single key in keybase–
      1. keybase pgp export
    2. If you have more than one key–
      1. keybase pgp export to find id if key you want to export
      2. keybase pgp export -q KEY_ID
  4. github admin for chanzuckerberg: take public key exported above and add it in the registry
  5. releaser: set KEYBASE_KEY_ID environment variable. Note that this is different from the previous id. Get this one from keybase pgp list. It should be like ~70 characters long.
  6. set GITHUB_TOKEN environment variable with a personal access token
  7. releaser: run make release-prerelease to test that releases are working correctly
  8. releaser: run make release to release for real
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].