-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Allow no-free clusters without replication_specs in clu2adv command #83
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
358797f
move out comment examples
lantoli 48eb5d0
failing tests with feature to implement
lantoli a80db24
free cluster if providerName == "TENANT"
lantoli 77d12d0
implementation
lantoli 8f784c3
undo changes in adv2v2
lantoli 7331af6
rename
lantoli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
6 changes: 0 additions & 6 deletions
6
internal/convert/testdata/adv2v2/missing_replication_specs.in.tf
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,42 @@ | ||
resource "mongodbatlas_cluster" "free_cluster" { | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
provider_name = "TENANT" | ||
backing_provider_name = "AWS" | ||
provider_region_name = var.region | ||
provider_instance_size_name = "M0" | ||
} | ||
|
||
resource "mongodbatlas_cluster" "count" { | ||
count = local.use_free_cluster ? 1 : 0 | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
provider_name = "TENANT" | ||
backing_provider_name = "AWS" | ||
provider_region_name = var.region | ||
provider_instance_size_name = "M0" | ||
} | ||
|
||
|
||
resource "mongodbatlas_cluster" "upgrade_from_free_cluster" { | ||
# upgraded free cluster to dedicated | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
provider_name = "AWS" # changed from TENANT to AWS | ||
provider_instance_size_name = "M10" # changed from M0 to M10 | ||
# removed backing_provider_name = AWS" | ||
provider_region_name = var.region | ||
} | ||
|
||
resource "mongodbatlas_cluster" "upgrade_from_free_cluster_with_variables" { | ||
# upgraded free cluster to dedicated, using variables in all attributes | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
provider_name = var.provider_name | ||
provider_instance_size_name = var.instance_size | ||
provider_region_name = var.region | ||
} | ||
|
||
resource "another_resource" "res1" { | ||
name = "name1" | ||
} |
This file contains hidden or 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,103 @@ | ||
resource "mongodbatlas_advanced_cluster" "free_cluster" { | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
cluster_type = "REPLICASET" | ||
replication_specs = [ | ||
{ | ||
region_configs = [ | ||
{ | ||
priority = 7 | ||
region_name = var.region | ||
provider_name = "TENANT" | ||
backing_provider_name = "AWS" | ||
electable_specs = { | ||
instance_size = "M0" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
# Generated by atlas-cli-plugin-terraform. | ||
# Please review the changes and confirm that references to this resource are updated. | ||
} | ||
|
||
resource "mongodbatlas_advanced_cluster" "count" { | ||
count = local.use_free_cluster ? 1 : 0 | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
cluster_type = "REPLICASET" | ||
replication_specs = [ | ||
{ | ||
region_configs = [ | ||
{ | ||
priority = 7 | ||
region_name = var.region | ||
provider_name = "TENANT" | ||
backing_provider_name = "AWS" | ||
electable_specs = { | ||
instance_size = "M0" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
# Generated by atlas-cli-plugin-terraform. | ||
# Please review the changes and confirm that references to this resource are updated. | ||
} | ||
|
||
|
||
resource "mongodbatlas_advanced_cluster" "upgrade_from_free_cluster" { | ||
# upgraded free cluster to dedicated | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
cluster_type = "REPLICASET" | ||
replication_specs = [ | ||
{ | ||
region_configs = [ | ||
{ | ||
priority = 7 | ||
region_name = var.region | ||
provider_name = "AWS" | ||
electable_specs = { | ||
instance_size = "M10" | ||
node_count = 3 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
# Generated by atlas-cli-plugin-terraform. | ||
# Please review the changes and confirm that references to this resource are updated. | ||
} | ||
|
||
resource "mongodbatlas_advanced_cluster" "upgrade_from_free_cluster_with_variables" { | ||
# upgraded free cluster to dedicated, using variables in all attributes | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
cluster_type = "REPLICASET" | ||
replication_specs = [ | ||
{ | ||
region_configs = [ | ||
{ | ||
priority = 7 | ||
region_name = var.region | ||
provider_name = var.provider_name | ||
electable_specs = { | ||
instance_size = var.instance_size | ||
node_count = 3 | ||
} | ||
} | ||
] | ||
} | ||
] | ||
|
||
# Generated by atlas-cli-plugin-terraform. | ||
# Please review the changes and confirm that references to this resource are updated. | ||
} | ||
|
||
resource "another_resource" "res1" { | ||
name = "name1" | ||
} |
21 changes: 5 additions & 16 deletions
21
internal/convert/testdata/clu2adv/free_cluster_missing_attribute.in.tf
This file contains hidden or 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 |
---|---|---|
@@ -1,19 +1,8 @@ | ||
resource "resource1" "res1" { | ||
name = "name1" | ||
} | ||
|
||
resource "mongodbatlas_cluster" "free_cluster" { # comment in the resource | ||
# comment in own line in the beginning | ||
count = local.use_free_cluster ? 1 : 0 | ||
project_id = var.project_id # inline comment kept | ||
name = var.cluster_name | ||
# comment in own line in the middle is deleted | ||
provider_name = "TENANT" # inline comment for attribute moved is not kept | ||
resource "mongodbatlas_cluster" "free_cluster" { | ||
project_id = var.project_id | ||
name = var.cluster_name | ||
provider_name = "TENANT" | ||
provider_region_name = var.region | ||
provider_instance_size_name = "M0" | ||
# comment in own line at the end happens before replication_specs | ||
} | ||
|
||
data "mongodbatlas_cluster" "cluster2" { | ||
name = "name4" | ||
# missing backing_provider_name | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.