GithubHelp home page GithubHelp logo

johnpeterharvey / terraform-provider-snowflake Goto Github PK

View Code? Open in Web Editor NEW

This project forked from snowflake-labs/terraform-provider-snowflake

0.0 1.0 0.0 21.09 MB

Terraform provider for managing Snowflake accounts

Home Page: https://registry.terraform.io/providers/chanzuckerberg/snowflake/latest

License: MIT License

Go 94.65% Makefile 0.92% Shell 4.43%

terraform-provider-snowflake's Introduction

Terraform Provider: Snowflake

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


Join the chat at https://gitter.im/chanzuckerberg/terraform-provider-snowflake Build Status codecov

This is a terraform provider plugin for managing Snowflake accounts.

Install

The easiest way is to run this command:

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

Note that this will only work with recent releases, for older releaes, use the version of download.sh that corresponds to that release (replace master 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.

TODO fogg config

Usage

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
  1. Fork this repo and clone it into go_projects
  2. cd to terraform-provider-snowflake and install all the required packages with make setup
  3. Finally install goimports with (cd && go get golang.org/x/tools/cmd/goimports).
  4. 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

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 suble 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.

We also run all tests in our Travis-CI account.

Pull Request CI

Our CI jobs run the full acceptence test suite, which involves creating and destroying resources in a live snowflake account. Travis-CI 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

Note: Currently only @ryanking and @edulop91 have keys that are whitelisted in the terraform registry, so only they can do releases.

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).

As of recently releases are also published to the terraform registry. That publishing requires that releases by signed. We do that signing via goreleaser using individual keybase keys. They key you want to use to sign must be passed in with the KEYBASE_KEY_ID environment variable.

terraform-provider-snowflake's People

Contributors

ackbyte avatar adamdewberry avatar ajbosco avatar alldoami avatar ataki avatar chauvm avatar chriskuchin avatar dependabot-preview[bot] avatar dholopik avatar emancu avatar haley-roberts avatar henriblancke avatar jnichols3 avatar jong82 avatar kuannie1 avatar marcinef avatar mbarrien avatar niallrees avatar pevloshevskaya avatar pwnage101 avatar ryanking avatar sjauld avatar tail avatar thalesmello avatar yuriolive avatar zpencerq avatar

Watchers

 avatar

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.