Giter Club home page Giter Club logo

cas-shelf's Introduction

Google Cloud Storage - Terraform

Terraform script to create GCS buckets in Montreal region based on namespace and application variables passed in. It creates 4 buckets, dev, test, prod, tools for each application.

Steps

  1. Download Terraform based on your operating system and architecture.

  2. Select an existing project or create a new one to have the project ID.

  3. Create a service account private key and download it as JSON format.

    • Go to IAM & Admin
    • GO to Service accounts
    • Create a Service account or select an exisiting one
    • Create a private key to download (credentials.json)
  4. Set basic Terraform environment variables

export TF_VAR_credentials=service_account_key_filepath # required, eg) credentials.json
export TF_VAR_project_name=project-name # required
export TF_VAR_backend_bucket=backend-bucket-name # required
export TF_VAR_envs='["dev", "test", "prod", "tools"]' # optional, default to ["dev", "test", "prod", "tools"]
  • Once application environment list is overridden via TF_VAR_envs, it will affect all other namespace sets.
  1. Create an initial GCS bucket to store Terraform state files.
cd remote-state
terraform init
terraform apply -auto-approve
cd ..
  1. Initialize a working directory and build or change infrastructure based on the configuration file main.tf.

    • Note that init command includes the backend configuration using required environment variables.
terraform init -backend-config="bucket=$TF_VAR_backend_bucket" -backend-config="credentials=$TF_VAR_credentials"
terraform apply -var="namespace=button" -var="application=cas" -auto-approve

cas-shelf's People

Contributors

wenzowski avatar junminahn avatar

Watchers

James Cloos 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.