-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Examples of terratest upgrade (#431)
* chore: updated terratest sdk * test: added terratest for upgrade in some resources * made changes suggested by angel and melissa * added newline to avoid github linter error Co-authored-by: Edgar López <[email protected]>
- Loading branch information
Showing
16 changed files
with
508 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
example.tf | ||
terraform.tfplan | ||
terraform.tfstate | ||
.terraform.lock.hcl | ||
bin/ | ||
modules-dev/ | ||
/pkg/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
resource "mongodbatlas_project" "test" { | ||
name = var.project_name | ||
org_id = var.org_id | ||
} | ||
|
||
resource "mongodbatlas_cluster" "test" { | ||
project_id = mongodbatlas_project.test.id | ||
name = var.cluster_name | ||
disk_size_gb = 100 | ||
num_shards = 1 | ||
replication_factor = 3 | ||
provider_backup_enabled = true | ||
pit_enabled = true | ||
auto_scaling_disk_gb_enabled = true | ||
mongo_db_major_version = var.mongodb_major_version | ||
|
||
// Provider Settings "block" | ||
provider_name = "AWS" | ||
provider_disk_iops = 300 | ||
provider_encrypt_ebs_volume = false | ||
provider_instance_size_name = "M30" | ||
provider_region_name = "EU_CENTRAL_1" | ||
} | ||
|
||
output "project_id" { | ||
value = mongodbatlas_project.test.id | ||
} | ||
output "cluster_name" { | ||
value = mongodbatlas_cluster.test.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "public_key" { | ||
description = "The public API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "private_key" { | ||
description = "The private API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "project_name" { | ||
description = "Atlas project name" | ||
default = "" | ||
} | ||
variable "org_id" { | ||
description = "The organization ID" | ||
default = "" | ||
} | ||
variable "cluster_name" { | ||
description = "Cluster name" | ||
default = "" | ||
} | ||
variable "mongodb_major_version" { | ||
description = "MongoDB major version" | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "0.8.2" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
resource "mongodbatlas_project" "test" { | ||
name = var.project_name | ||
org_id = var.org_id | ||
} | ||
|
||
resource "mongodbatlas_cluster" "test" { | ||
project_id = mongodbatlas_project.test.id | ||
name = var.cluster_name | ||
disk_size_gb = 100 | ||
num_shards = 1 | ||
replication_factor = 3 | ||
provider_backup_enabled = true | ||
pit_enabled = true | ||
auto_scaling_disk_gb_enabled = true | ||
mongo_db_major_version = var.mongodb_major_version | ||
|
||
// Provider Settings "block" | ||
provider_name = "AWS" | ||
provider_disk_iops = 300 | ||
provider_encrypt_ebs_volume = false | ||
provider_instance_size_name = "M30" | ||
provider_region_name = "EU_CENTRAL_1" | ||
} | ||
|
||
output "project_id" { | ||
value = mongodbatlas_project.test.id | ||
} | ||
output "cluster_name" { | ||
value = mongodbatlas_cluster.test.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "public_key" { | ||
description = "The public API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "private_key" { | ||
description = "The private API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "project_name" { | ||
description = "Atlas project name" | ||
default = "" | ||
} | ||
variable "org_id" { | ||
description = "The organization ID" | ||
default = "" | ||
} | ||
variable "cluster_name" { | ||
description = "Cluster name" | ||
default = "" | ||
} | ||
variable "mongodb_major_version" { | ||
description = "MongoDB major version" | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "0.7.0" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
resource "mongodbatlas_project" "test" { | ||
name = var.project_name | ||
org_id = var.org_id | ||
} | ||
|
||
resource "mongodbatlas_database_user" "test" { | ||
username = var.username | ||
x509_type = "CUSTOMER" | ||
project_id = mongodbatlas_project.test.id | ||
auth_database_name = "$external" | ||
|
||
roles { | ||
role_name = var.role_name | ||
database_name = "admin" | ||
} | ||
|
||
labels { | ||
key = "First Key" | ||
value = "First Value" | ||
} | ||
} | ||
|
||
output "project_id" { | ||
value = mongodbatlas_project.test.id | ||
} | ||
output "username" { | ||
value = mongodbatlas_database_user.test.username | ||
} | ||
output "auth_database_name" { | ||
value = mongodbatlas_database_user.test.auth_database_name | ||
} |
24 changes: 24 additions & 0 deletions
24
examples/test-upgrade/v090/database-user/v082/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "public_key" { | ||
description = "The public API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "private_key" { | ||
description = "The private API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "project_name" { | ||
description = "Atlas project name" | ||
default = "" | ||
} | ||
variable "org_id" { | ||
description = "The organization ID" | ||
default = "" | ||
} | ||
variable "username" { | ||
description = "Username" | ||
default = "" | ||
} | ||
variable "role_name" { | ||
description = "The role name" | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
terraform { | ||
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "0.8.2" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
resource "mongodbatlas_project" "test" { | ||
name = var.project_name | ||
org_id = var.org_id | ||
} | ||
|
||
resource "mongodbatlas_database_user" "test" { | ||
username = var.username | ||
ldap_auth_type = "USER" | ||
project_id = mongodbatlas_project.test.id | ||
auth_database_name = "$external" | ||
|
||
roles { | ||
role_name = var.role_name | ||
database_name = "admin" | ||
} | ||
|
||
labels { | ||
key = "First Key" | ||
value = "First Value" | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
examples/test-upgrade/v090/database-user/v090/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "public_key" { | ||
description = "The public API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "private_key" { | ||
description = "The private API key for MongoDB Atlas" | ||
default = "" | ||
} | ||
variable "project_name" { | ||
description = "Atlas project name" | ||
default = "" | ||
} | ||
variable "org_id" { | ||
description = "The organization ID" | ||
default = "" | ||
} | ||
variable "username" { | ||
description = "Username" | ||
default = "" | ||
} | ||
variable "role_name" { | ||
description = "The role name" | ||
default = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "0.7.0" | ||
} | ||
} | ||
required_version = ">= 0.13" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.