Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starter example improvements and doc update #474

Merged
merged 2 commits into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/starter/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ This project aims to provide a very straight-forward example of setting up Terra
- Database User
- IP Access List

You can refer to the MongoDB Atlas documentation to know about the region names used in MongoDB Atlas respective to the Cloud Provier's region name.
You can refer to the MongoDB Atlas documentation to know about the region names used in MongoDB Atlas respective to the Cloud Provider's region name.
[Amazon Web Services (AWS)](https://docs.atlas.mongodb.com/reference/amazon-aws/#amazon-aws)
[Google Cloud Platform (GCP)](https://docs.atlas.mongodb.com/reference/google-gcp/#google-gcp)
[Microsoft Azure](https://docs.atlas.mongodb.com/reference/microsoft-azure/#microsoft-azure)

## Dependencies

* Terraform v0.13
* Terraform v0.13 or greater
* A MongoDB Atlas account
* provider.mongodbatlas: version = "~> 0.7.0"
* provider.mongodbatlas: version = "~> 0.9.1"

## Usage

Expand Down
11 changes: 5 additions & 6 deletions examples/starter/atlas_cluster.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "mongodbatlas_cluster" "cluster" {
project_id = mongodbatlas_project.project.id
name = "mongodb-atlas"
name = var.cluster_name
mongo_db_major_version = var.mongodbversion
cluster_type = "REPLICASET"
replication_specs {
Expand All @@ -15,11 +15,10 @@ resource "mongodbatlas_cluster" "cluster" {
//Provider Settings "block"
provider_backup_enabled = true
auto_scaling_disk_gb_enabled = true
provider_name = "AWS"
disk_size_gb = 10
provider_name = var.cloud_provider
provider_instance_size_name = "M10"
provider_encrypt_ebs_volume = true
}
output "atlasclusterstring" {
value = mongodbatlas_cluster.cluster.connection_strings
output "connection_strings" {
value = mongodbatlas_cluster.cluster.connection_strings.0.standard_srv
}

4 changes: 2 additions & 2 deletions examples/starter/ip_access_list.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "mongodbatlas_project_ip_access_list" "ip" {
project_id = mongodbatlas_project.project.id
ip_address = "77.107.233.162"
comment = "cidr block for accessing the cluster"
ip_address = var.ip_address
comment = "IP Address for accessing the cluster"
}
output "ipaccesslist" {
value = mongodbatlas_project_ip_access_list.ip.ip_address
Expand Down
50 changes: 37 additions & 13 deletions examples/starter/variables.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,51 @@
variable "public_key" {
description = "Public API key to authenticate to Atlas"
type = string
description = "Public Programmatic API key to authenticate to Atlas"
}
variable "private_key" {
description = "Private API key to authenticate to Atlas"
type = string
description = "Private Programmatic API key to authenticate to Atlas"
}
variable "dbuser" {
description = "MongoDB Atlas Database User"
variable "org_id" {
type = string
description = "MongoDB Organization ID"
}
variable "dbuser_password" {
description = "MongoDB Atlas Database User Password"
variable "project_name" {
type = string
description = "The MongoDB Atlas Project Name"
}
variable "database_name" {
description = "The Database in the cluster"
variable "cluster_name" {
type = string
description = "The MongoDB Atlas Cluster Name"
}
variable "org_id" {
description = "MongoDB Organization ID"
variable "cloud_provider" {
type = string
description = "The cloud provider to use, must be AWS, GCP or AZURE"
}
variable "region" {
description = "MongoDB Atlas Cluster Region"
type = string
description = "MongoDB Atlas Cluster Region, must be a region for the provider given"
}
variable "mongodbversion" {
type = string
description = "The Major MongoDB Version"
}
variable "project_name" {
description = "The Atlas Project Name"
variable "dbuser" {
type = string
description = "MongoDB Atlas Database User Name"
}
variable "dbuser_password" {
type = string
description = "MongoDB Atlas Database User Password"
}
variable "database_name" {
type = string
description = "The database in the cluster to limit the database user to, the database does not have to exist yet"
}
variable "ip_address" {
type = string
description = "The IP address that the cluster will be accessed from, can also be a CIDR range or AWS security group"
}



7 changes: 4 additions & 3 deletions website/docs/index.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ For more information on configuring and managing programmatic API Keys see the [

[Support](https://docs.atlas.mongodb.com/support/) covered by MongoDB Atlas support plans, Developer and above.

## Examples from the Community
## Examples from MongoDB and the Community

Have a good example you've created and want to share? Let us know the details via an [issue](https://github.com/mongodb/terraform-provider-mongodbatlas/issues)
We have [example configurations](https://github.com/mongodb/terraform-provider-mongodbatlas/tree/master/examples) in our GitHub repo that will help both beginner and more advanced users.

Have a good example you've created and want to share? Let us know the details via an [issue](https://github.com/mongodb/terraform-provider-mongodbatlas/issues) or submit a PR of your work to add it to the examples directory in our [GitHub repo](https://github.com/mongodb/terraform-provider-mongodbatlas/).

[Example - AWS and Atlas PrivateLink with Terraform](https://github.com/nikhil-mongo/aws-atlas-privatelink)