Coder Social home page Coder Social logo

ds-terraform's Introduction

debtcollective terraform

This is the terraform recipes we use to generate our production environment. This is in phase out mode and will be replaced by infra.

Installation

This repo is compatible with Terraform v0.11.14. To install this specific version use tfenv

brew install tfenv
tfenv install 0.11.14

Then follow these steps to init your environment

  1. cp env.sample .env and replace variables with valid AWS credentials with permissions we need to create all the infrastructure
  2. source .env
  3. make init

Usage

When you are making a change, follow this loop

  1. make plan to see your changes in memory
  2. make apply to apply changes

make apply will also upload the terraform.tfvars file (that is ignored from the git repository since it has sensible data). When you run make init this file will be pulled from the remote.

If more than one person is modifying these files, you can make sure you have the latest terraform.tfvars file by running make tfvars-pull. This command will override your local terraform.tfvars file, and since is not commited to git, you will lose your changes (if any)

Environments

Each environment has its own folder under the environments folder.

Create a new environment

The easiest way to create a new environment is by copying an existing one

  1. Copy any environment you like to replicate to a new folder and cd there
  2. Delete ssh keys (rm key_pair_*) and create new ones (ssh-keygen -f key_pair_${env})
  3. Change Makefile and main.tf environment variable to match the folder name
  4. Run make init

How-to

Connect to the postgres database from your local instance

RDS databases are only reachable from an instance in the ec2_security_group. You can connect to the database using an SSH tunnel

ssh -N -L 9998:<rds_address>:5432 ubuntu@<instance-ip> -p 12345

Then connect to the database using the tunnel

psql -h localhost -p 9998 -d debtcollective_prod -U debtcollective < backup.sql

ds-terraform's People

Contributors

orlando avatar berleant avatar okdistribute avatar

Stargazers

 avatar

Watchers

Thiago de Mello Bueno avatar  avatar James Cloos avatar  avatar Jacques Laroche avatar Paul Lanctot 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.