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

Upgrade Cosmos version from 2020-04-01-preview to 2021-01-15 #10926

Merged
merged 22 commits into from
Apr 27, 2021

Conversation

yupwei68
Copy link
Contributor

@yupwei68 yupwei68 commented Mar 11, 2021

All tests have passed

changes:

  1. variable indexing_mode and order in resources azurerm_cosmosdb_sql_container and azurerm_cosmosdb_gremlin_graph is defined and returned in lower case instead of hybrid case. We keep the original hybrid cases instead of breaking changes.

breaking changes:

  1. cosmos mongodb account default to "v3.6" instead of "v3.2". The changes occur in azurerm_cosmosdb_account tests. Thus, _id index is required in azurerm_cosmosdb_mongo_collection .
  2. "patition_key_path" is "required" instead of "optional" in azurerm_cosmosdb_gremlin_graph and azurerm_cosmosdb_sql_container .

@ghost ghost added the size/XXL label Mar 11, 2021
@yupwei68 yupwei68 changed the title Upgrade Cosmos version to 2021-01-15 Upgrade Cosmos version from 2020-04-01-preview to 2021-01-15 Mar 11, 2021
@yupwei68
Copy link
Contributor Author

image

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @yupwei68 - i've left some comments inline. Also we have a test failure:

------- Stdout: -------
=== RUN   TestAccCosmosDbMongoCollection_autoscale
=== PAUSE TestAccCosmosDbMongoCollection_autoscale
=== CONT  TestAccCosmosDbMongoCollection_autoscale
    testing_new_import_state.go:249: ImportStateVerify attributes not equivalent. Difference is shown below. Top is actual, bottom is expected.
        
        (map[string]string) (len=1) {
         (string) (len=10) "throughput": (string) (len=3) "500"
        }
        
        
        (map[string]string) (len=1) {
         (string) (len=10) "throughput": (string) (len=3) "400"
        }
--- FAIL: TestAccCosmosDbMongoCollection_autoscale (1235.42s)
FAIL

@@ -123,7 +123,7 @@ func CosmosDbIndexingPolicySchema() *schema.Schema {
ValidateFunc: validation.StringInSlice([]string{
string(documentdb.Consistent),
string(documentdb.None),
}, false),
}, true),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we making this case insensitive? the SDK values should match what we get from the API?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In preview version, the value is "consistent" and "none", but in current version, the value is "Consistent" and "None". To resolve the breaking change, I set it to be case insensitive?

Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of making this case insensitive can we just correct the casing to the SDK values on read?

also - could we open an issue on the SDK or somewhere to track this discrepancy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The case has been change when the service has released 2020-04-01 stable version. The old 2020-04-01-preview version has been deleted.
Since preview version permits breaking changes, shall I not open the issue?

azurerm/internal/services/cosmos/common/schema.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

.

@yupwei68
Copy link
Contributor Author

Hi @katbyte Thanks for comments. I've run this test for three times locally. It all passed. I think it's a random hiccup.
=== RUN TestAccCosmosDbMongoCollection_autoscale
=== PAUSE TestAccCosmosDbMongoCollection_autoscale
=== CONT TestAccCosmosDbMongoCollection_autoscale
--- PASS: TestAccCosmosDbMongoCollection_autoscale (5617.59s)

@yupwei68
Copy link
Contributor Author

Hi kt, I've solved the breaking change. And all tests have passed.
image

Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks, just a few small things left to address and this'll be good to merge

@@ -123,7 +123,7 @@ func CosmosDbIndexingPolicySchema() *schema.Schema {
ValidateFunc: validation.StringInSlice([]string{
string(documentdb.Consistent),
string(documentdb.None),
}, false),
}, true),
Copy link
Collaborator

Choose a reason for hiding this comment

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

instead of making this case insensitive can we just correct the casing to the SDK values on read?

also - could we open an issue on the SDK or somewhere to track this discrepancy?

@yupwei68
Copy link
Contributor Author

Thanks kt for your comments. I've changed all these. Please continue reviewing.

@yupwei68 yupwei68 requested a review from katbyte April 21, 2021 10:01
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

Thanks @yupwei68 - aside from one comment inline (add todo 3.0 to those constants) and these two test failures this looks ready to merge!

------- Stdout: -------
=== RUN   TestAccCosmosDbSqlStoredProcedure_basic
=== PAUSE TestAccCosmosDbSqlStoredProcedure_basic
=== CONT  TestAccCosmosDbSqlStoredProcedure_basic
    testing.go:620: Step 1/2 error: Error running pre-apply refresh: 
        Error: Missing required argument
        
          on config293530581/terraform_plugin_test.tf line 35, in resource "azurerm_cosmosdb_sql_container" "test":
          35: resource "azurerm_cosmosdb_sql_container" "test" {
        
        The argument "partition_key_path" is required, but no definition was found.
        
--- FAIL: TestAccCosmosDbSqlStoredProcedure_basic (6.26s)
FAIL

------- Stderr: -------
2021/04/22 04:53:16 [DEBUG] not using binary driver name, it's no longer needed
2021/04/22 04:53:16 [DEBUG] not using binary driver name, it's no longer needed
------- Stdout: -------
=== RUN   TestAccCosmosDbSqlStoredProcedure_update
=== PAUSE TestAccCosmosDbSqlStoredProcedure_update
=== CONT  TestAccCosmosDbSqlStoredProcedure_update
    testing.go:620: Step 1/4 error: Error running pre-apply refresh: 
        Error: Missing required argument
        
          on config415328271/terraform_plugin_test.tf line 35, in resource "azurerm_cosmosdb_sql_container" "test":
          35: resource "azurerm_cosmosdb_sql_container" "test" {
        
        The argument "partition_key_path" is required, but no definition was found.
        
--- FAIL: TestAccCosmosDbSqlStoredProcedure_update (6.02s)
FAIL

------- Stderr: -------
2021/04/22 04:53:21 [DEBUG] not using binary driver name, it's no longer needed
2021/04/22 04:53:21 [DEBUG] not using binary driver name, it's no longer needed

@katbyte katbyte added this to the v2.57.0 milestone Apr 22, 2021
@yupwei68
Copy link
Contributor Author

image
Hi kt, tests have passed.

@yupwei68
Copy link
Contributor Author

Hi kt, I've updated the description of the PR to list all changes and breaking changes.

@katbyte katbyte merged commit 5c91f84 into hashicorp:master Apr 27, 2021
katbyte added a commit that referenced this pull request Apr 27, 2021
@yupwei68 yupwei68 deleted the wyp-cosmos-version branch April 28, 2021 02:14
@ghost
Copy link

ghost commented Apr 30, 2021

This has been released in version 2.57.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.57.0"
}
# ... other configuration ...

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants