Skip to content

fixes #210: Issues with advanced_configuration section on mongodbatlas_cluster #238

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

Conversation

gmlp
Copy link
Contributor

@gmlp gmlp commented Jun 3, 2020

fixes #210 Issues with advanced_configuration section on mongodbatlas_cluster Opt2
This is option 2:
Based on some testing, research and some conversation with @marinsalinas and @PacoDw :

Since the migration process happens before a state change (on refresh or on apply) using the new binary. All the arguments of advanced_configuration are computed/optional meaning that these values will be retrieved from the API after state migration.

Link to any related issue(s):
closes: https://github.com/terraform-providers/terraform-provider-mongodbatlas/issues/210

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the Terraform contribution guidelines
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code

Further comments

@gmlp gmlp requested a review from marinsalinas June 3, 2020 17:44
@themantissa
Copy link
Collaborator

Overall I think this is good - the only thing I believe we need is to add clear guidance to users about what will happen like we did for 0.4.0. Since this is the 2nd time we've needed this I'd like to do what some other providers have done and also add a new page in our Terraform doc to list information about version changes (similar to the Guides section in https://www.terraform.io/docs/providers/azurerm/index.html, with a page called Upgrade Guide for 0.6.0). That probably makes sense for another PR to create the new menu item and page/content but we'll need it before we release.

Also fyi (esp @shum before you review) - I built this tonight and ran through some options - data below. Overall it works well and as expected. As long as we explain the state migration, i.e. why advanced configs is now showing up in the plan and that a refresh w/ plan is needed I think we'll be good.
Created cluster via terraform 0.5.1, no advanced_config options in cluster resource config - state file contains:
"advanced_configuration": {
"fail_index_key_too_long": "true",
"javascript_enabled": "true",
"minimum_enabled_tls_protocol": "TLS1_2",
"no_table_scan": "false",
"oplog_size_mb": "",
"sample_refresh_interval_bi_connector": "",
"sample_size_bi_connector": ""
},

Direct API: List Adv Config API call
{
"failIndexKeyTooLong" : true,
"javascriptEnabled" : true,
"minimumEnabledTlsProtocol" : "TLS1_2",
"noTableScan" : false,
"oplogSizeMB" : null,
"sampleRefreshIntervalBIConnector" : null,
"sampleSizeBIConnector" : null

Run plan with new provider from PR #238 - Same as earlier state

Make change in .tf M10 to M20, run plan ...

Run plan without refresh:
No advanced_config change noted, M20 change found
~ provider_instance_size_name = "M10" -> "M20"

Run plan with refresh:
M20 changed found and advanced_config block now shows on output with zeros and not empty strings:
~ provider_instance_size_name = "M10" -> "M20"
advanced_configuration {
fail_index_key_too_long = true
javascript_enabled = true
minimum_enabled_tls_protocol = "TLS1_2"
no_table_scan = false
oplog_size_mb = 0
sample_refresh_interval_bi_connector = 0
sample_size_bi_connector = 0

Apply w/ refresh and now new state file is correct and no changes on the Atlas side when direct API call made:
"advanced_configuration": [
{
"fail_index_key_too_long": true,
"javascript_enabled": true,
"minimum_enabled_tls_protocol": "TLS1_2",
"no_table_scan": false,
"oplog_size_mb": 0,
"sample_refresh_interval_bi_connector": 0,
"sample_size_bi_connector": 0
}

Oplog/BI Connector changes:

Change oplog in UI ->
Terrraform plan did not pick up any change, state did not change
Terraform refresh did pick up change, changes in state file match UI change

Then set bi connector enabled in configuration and set 3 options:

advanced_configuration {
oplog_size_mb = 5500
sample_refresh_interval_bi_connector = 300
sample_size_bi_connector = 30000
}
Plan shows
advanced_configuration {
fail_index_key_too_long = true
javascript_enabled = true
minimum_enabled_tls_protocol = "TLS1_2"
no_table_scan = false
~ oplog_size_mb = 10000 -> 5500
~ sample_refresh_interval_bi_connector = 0 -> 300
~ sample_size_bi_connector = 0 -> 30000
}
Apply worked and UI matched.

Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment but as long as @shum and one DoU dev approves I'm good.

Copy link
Contributor

@PacoDw PacoDw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@marinsalinas marinsalinas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! great work :) :shipit:

@gmlp gmlp force-pushed the fixes-210-issues-with-advanced_configuration-mongodbatlas_cluster_opt2 branch from e7f52f9 to a47d522 Compare June 5, 2020 14:53
@gmlp gmlp force-pushed the fixes-210-issues-with-advanced_configuration-mongodbatlas_cluster_opt2 branch from 116ff0a to 5bd9cd4 Compare June 8, 2020 14:51
@gmlp gmlp merged commit b3e6790 into master Jun 8, 2020
@gmlp gmlp deleted the fixes-210-issues-with-advanced_configuration-mongodbatlas_cluster_opt2 branch June 8, 2020 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues with advanced_configuration section on mongodbatlas_cluster
5 participants