Giter Site home page Giter Site logo

terraform-aws-mongodb's Introduction

terraform-aws-mongodb

Lint Status LICENSE

The following content needed to be created and managed:

  • Introduction
    • Explaination of module
    • Intended users
  • Resource created and managed by this module
  • Example Usages

Introduction

This repository allows creating MongoDB ReplicaSet in AWS EC2 instances. It includes the following resources:

  • Jumpbox Instance (*Optional - If terraform is invoked from Local):
    • To access our MongoDB servers
    • To copy replication and cluster configutration files to MongoDB servers
  • Primary MongoDB Instance
  • Secondary MongoDB Instances (you can define the count of read replicas here. By default, this creates 2 secondary nodes)

Pre-Requisites

  • AWS CLI must be installed and aws-profile must be already created
  • AWS VPC must be already configured with min. 2 private subnets, 2 public subnets, and Nat gateway
    • Public Subnets: Jumpbox is setup here
    • Private Subnets: MongoDB nodes and NAT gateway

Usage

module mongodb {
  source = "git::https://github.com/tothenew/terraform-aws-mongodb.git"
  region = "<default region>"
  secondary_node_type = "<secondary node type>"
  primary_node_type = "<primary node type>"
  vpc_id     = "<vpc id>"
  mongo_subnet_ids = "<private subnet ids>"
  jumpbox_subnet_ids = "<public subnet ids>"
  mongo_database = "<sample database name>"
}

However, below properties can also be passed as custom parameters, otherwise will be picked from variables.tf as default

profile
instance_user
key_name
environment
replica_set_name
mongo_username
num_secondary_nodes
domain_name
ssm_parameter_prefix

Requirements

Name Version
terraform >= 1.3.0
aws >= 3.72

Providers

Name Version
aws >= 3.72

Resources

Name Type
random_string resource
aws_key_pair resource
aws_ssm_parameter resource
aws_instance resource
aws_security_group resource
aws_iam_role resource
aws_iam_instance_profile resource
aws_iam_role_policy resource

Inputs

Name Description Type Default Required
secondary_node_type Instance type of Slave MongoDB Nodes string t2.micro yes
primary_node_type Instance type of Master MongoDB Node string t2.micro yes
jumpbox_instance_type Instance type of Bastion Server string t2.nano yes
instance_user SSH Username string ubuntu yes
key_name pem key file to ssh into servers string mongo yes
vpc_id VPC ID where you want to launch your servers string NA yes
environment Environment Tag Name string DEV yes
mongo_subnet_ids List of Subnet Ids where MongoDB will be running (should be private) list NA yes
jumpbox_subnet_ids Subnet IDs where Bastion Server will be running (should be public) list NA yes
vpc_cidr_block This is for Security Group egress rules string 0.0.0.0/0 yes
replica_set_name Name of the MongoDB Replicaset which will be created string MongoRs yes
mongo_username MongoDB Username string admin yes
mongo_database MongoDB Database string admin yes
num_secondary_nodes Number of Slave MongoDB Nodes integer 2 yes
custom_domain If "true", then the custom domain name will be used for MongoDB else default Private IPs will be used bool flase yes
domain_name The custom domain name if required string n/a yes (only if "custom_domain" is set to true)
ssm_parameter_prefix Prefix for SSM Parameter Key Name string MongoDB yes

Authors

Module managed by TO THE NEW Pvt. Ltd.

License

Apache 2 Licensed. See LICENSE for full details.

terraform-aws-mongodb's People

Contributors

ketan-joshi avatar tarunsaxenattn avatar rahulttn avatar nitinbhadauria avatar github-actions[bot] 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.