Skip to content

Commit

Permalink
add mongodbatlas_project to examples
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaykarle committed Mar 25, 2018
1 parent 92e1578 commit 2808349
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions examples/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
variable "mongodb_atlas_username" {}
variable "mongodb_atlas_api_key" {}
variable "mongodb_atlas_group_id" {}
variable "mongodb_atlas_org_id" {}
variable "aws_account_id" {}
variable "vpc_id" {}
variable "vpc_cidr_block" { default = "10.1.0.0/16" }
Expand All @@ -13,24 +13,30 @@ provider "mongodbatlas" {
api_key = "${var.mongodb_atlas_api_key}"
}

# Create a Group
resource "mongodbatlas_project" "test" {
org_id = "${var.mongodb_atlas_org_id}"
name = "test"
}

# Create a Group IP Whitelist
resource "mongodbatlas_ip_whitelist" "test" {
group = "${var.mongodb_atlas_group_id}"
group = "${mongodbatlas_project.test.id}"
cidr_block = "${var.whitelist_cidr_block}"
comment = "test"
}

# Create a Container
resource "mongodbatlas_container" "test" {
group = "${var.mongodb_atlas_group_id}"
group = "${mongodbatlas_project.test.id}"
atlas_cidr_block = "10.0.0.0/21"
provider_name = "AWS"
region = "US_EAST_1"
}

# Initiate a Peering connection
resource "mongodbatlas_vpc_peering_connection" "test" {
group = "${var.mongodb_atlas_group_id}"
group = "${mongodbatlas_project.test.id}"
aws_account_id = "${var.aws_account_id}"
vpc_id = "${var.vpc_id}"
route_table_cidr_block = "${var.vpc_cidr_block}"
Expand All @@ -40,7 +46,7 @@ resource "mongodbatlas_vpc_peering_connection" "test" {
# Create a Cluster
resource "mongodbatlas_cluster" "test" {
name = "test"
group = "${var.mongodb_atlas_group_id}"
group = "${mongodbatlas_project.test.id}"
mongodb_major_version = "3.4"
provider_name = "AWS"
region = "US_EAST_1"
Expand All @@ -54,7 +60,7 @@ resource "mongodbatlas_database_user" "test" {
username = "test"
password = "${var.database_user_test_password}"
database = "admin"
group = "${var.mongodb_atlas_group_id}"
group = "${mongodbatlas_project.test.id}"
roles = [
{
name = "read"
Expand Down

0 comments on commit 2808349

Please sign in to comment.