Skip to content

I managed to create the group/user and cluster, but where is the db?  #107

@hilaryRope

Description

@hilaryRope

Hi,
apologies if i am a bit of a newbie when it comes to Mongodb atlas and the terraform provider, but I am successfully creating group, user and cluster, but when I inspect my cluster I see no database or collection created, where am I going wrong? Here is some details from my main.tf:

# Create a db user
resource "mongodbatlas_database_user" "mongodb_user" {
  username = "${var.database_username}"
  password = "${random_string.master_password.result}"
  project_id = "${mongodbatlas_project.mongodb.id}"
  database_name  = "admin"

  roles {
    role_name = "readWrite"
    database_name = "admin"
  }
}

group

resource "mongodbatlas_project" "mongodb"{
  org_id = "${var.mongodb_atlas_org_id}"
  name = "${var.project_name}-${var.stage}"
 }

cluster

# Create a cluster
resource "mongodbatlas_cluster" "mongodb-cluster" {
  project_id = "${mongodbatlas_project.mongodb.id}"
  name = "${var.cluster_name}-${var.stage}"
  num_shards = 1

  replication_factor = 3
  backup_enabled = true
  auto_scaling_disk_gb_enabled = true
  mongo_db_major_version = "4.0"

  //Provider Settings "block"
  provider_name = "AWS"
  disk_size_gb = 100
  provider_disk_iops = 300
  provider_encrypt_ebs_volume = false
  provider_instance_size_name = "M40"
  provider_region_name = "us-east-1"
}

I am not sure I follow, but I was under the impression that the db should also be created automatically by terraform inside the cluster?

Thank you so much for your help

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions