-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
azurerm_cosmosdb_account
- support new property backup.tier
#24595
azurerm_cosmosdb_account
- support new property backup.tier
#24595
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there two tests with free running at the same time?
------- Stdout: -------
=== RUN TestAccCosmosDBAccount_freeTier
=== PAUSE TestAccCosmosDBAccount_freeTier
=== CONT TestAccCosmosDBAccount_freeTier
testcase.go:113: Step 1/2 error: Error running apply: exit status 1
Error: creating Database Account (Subscription: "*******"
Resource Group Name: "acctestRG-cosmos-240131191536431459"
Database Account Name: "acctest-ca-240131191536431459"): creating/updating CosmosDB Account "acctest-ca-240131191536431459" (Resource Group "acctestRG-cosmos-240131191536431459"): performing DatabaseAccountsCreateOrUpdate: cosmosdb.CosmosDBClient#DatabaseAccountsCreateOrUpdate: Failure sending request: StatusCode=0 -- Original Error: Code="BadRequest" Message="Free tier has already been applied to another Azure Cosmos DB account in this subscription. To apply free tier to this account, you can select another subscription for this account or delete the existing free tier account. You can have up to one free tier account per subscription.\r\nActivityId: d1f6b976-70b9-4381-915e-4d4ca07bc7ae, Microsoft.Azure.Documents.Common/2.14.0"
with azurerm_cosmosdb_account.test,
on terraform_plugin_test.tf line 26, in resource "azurerm_cosmosdb_account" "test":
26: resource "azurerm_cosmosdb_account" "test" {
--- FAIL: TestAccCosmosDBAccount_freeTier (103.94s)
FAIL
lifecycle { | ||
ignore_changes = [backup.0.tier] | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how come this is required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two reasons.
Reason 1: Though tier
has the default value Continuous30Days
but tier
is only for the backup type Continuous
. So the default value isn't added in the property schema.
Reason 2: API would return the default value Continuous30Days
when backup.type is Continuous
and tier
isn't set. At this time, it would cause diff. So here ignore_changes for tier
is added.
Note: I updated PR to add the note for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like this is a bug, is there no way to correctly handle this so lifecycle ignore changes is not requireD? is this an API bug with the API not returning the correct values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service team confirmed that it's by API design. Actually, This new property is called ContinuousTier in azure-rest-api-spec, which means it only supports the backup type "Continuous" and it doesn't support the backup type "Periodic". So I assume that it's not an API bug.
I listed all behaviors for this new property:
Scenario 1: API doesn't return default value for this new property "ContinuousTier" when backup type is "Periodic" and "ContinuousTier" isn't set.
Scenario 2: API doesn't return any value for this new property "ContinuousTier" when backup type is "Periodic" and "ContinuousTier" is set.
Scenario 3: API returns default value "Continuous30Days" for this new property "ContinuousTier" when backup type is "Continuous" and "ContinuousTier" isn't set.
Scenario 4: API returns value "Continuous7Days" for this new property "ContinuousTier" when backup type is "Continuous" and ContinuousTier is set to "Continuous7Days".
Scenario 5: API returns value "Continuous30Days" for this new property "ContinuousTier" when backup type is "Continuous" and ContinuousTier is set to "Continuous30Days".
@katbyte , yes. TestAccCosmosDBAccount_freeTier is triggered in parallel and all test cases passed. See below latest test result. |
@katbyte , I replied you for your concern. Please take another look. Thanks. |
@katbyte , thanks for the suggestion. I updated PR. Please take another look. Thanks. Below is the test result I just now triggered. The failed test case is also failed with same error in the Teamcity Daily Run. So I think that the failure is not related with this PR. Actually, there is already an existing PR to fix this issue. |
azurerm_cosmosdb_account
- support new property tier
azurerm_cosmosdb_account
- support new property backup.tier
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @neil-yechenwei - LGTM 🍣
…icorp#24595) * azurerm_cosmosdb_account - support new property tier * update code * update code * update code * update code * update code * update code
<Actions> <action id="f410411e63aff4bb73a81c2aec1d373cf8a903e63b30dee2006b0030d8a94cc8"> <h3>Bump Terraform `azurerm` provider version</h3> <details id="1d9343c012f5434ac9fe8a98135bae3667b399259be16d9b14302ea3bd424a24"> <summary>Update Terraform lock file</summary> <p>changes detected:
	"hashicorp/azurerm" updated from "3.92.0" to "3.93.0" in file ".terraform.lock.hcl"</p> <details> <summary>3.93.0</summary> <pre>Changelog retrieved from:
	https://github.com/hashicorp/terraform-provider-azurerm/releases/tag/v3.93.0
* **New Data Source**: `azurerm_express_route_circuit_peering` ([#24971](hashicorp/terraform-provider-azurerm#24971 **New Data Source**: `azurerm_storage_table_entities` ([#24973](hashicorp/terraform-provider-azurerm#24973 **New Resource**: `azurerm_dev_center_catalog` ([#24833](hashicorp/terraform-provider-azurerm#24833 **New Resource**: `azurerm_system_center_virtual_machine_manager_server` ([#24278](https://github.com/hashicorp/terraform-provider-azurerm/issues/24278))

BUG FIXES:

* `azurerm_key_vault` - conditionally polling the Data Plane endpoint when `public_network_access_enabled` is set to false ([#23823](hashicorp/terraform-provider-azurerm#23823 `azurerm_storage_account` - allow the `identity.type` property to be `SystemAssigned, UserAssigned` when using a Customer Managed Key ([#24923](hashicorp/terraform-provider-azurerm#24923 `azurerm_automation_account` - prevent the `identity.identity_ids` User Assigned identity being set when not specified in config ([#24977](https://github.com/hashicorp/terraform-provider-azurerm/issues/24977))

ENHANCEMENTS:

* dependencies: updating to `v0.20240221.1170458` of `hashicorp/go-azure-sdk` ([#24967](hashicorp/terraform-provider-azurerm#24967 dependencies: refactor `azurerm_spring_cloud_configuration_service` to use `go-azure-sdk` ([#24918](hashicorp/terraform-provider-azurerm#24918 provider: support or the feature flag `virtual_machine_scale_set.reimage_on_manual_upgrade` ([#22975](hashicorp/terraform-provider-azurerm#22975 `sentinel`: updating to use the transport layer from `hashicorp/go-azure-sdk` rather than `Azure/go-autorest` ([#24962](hashicorp/terraform-provider-azurerm#24962 `sqlvirtualmachines`: updating to use the transport layer from `hashicorp/go-azure-sdk` rather than `Azure/go-autorest` ([#24912](hashicorp/terraform-provider-azurerm#24912 `nginx` : updating to use `2024-01-01-preview` ([#24868](hashicorp/terraform-provider-azurerm#24868 `azurerm_cosmosdb_account` - support for the `backup.tier` property ([#24595](hashicorp/terraform-provider-azurerm#24595 `azurerm_linux_virtual_machine` - the `virtual_machine_scale_set_id` proeprty can now be changed without creating a new resource ([#24768](hashicorp/terraform-provider-azurerm#24768 `azurerm_machine_learning_workspace` - support for the `managed_network.isolation_mode` property ([#24951](hashicorp/terraform-provider-azurerm#24951 `azurerm_private_dns_resolver_inbound_endpoint` - support the `static` value for the `private_ip_allocation_method` property ([#24952](hashicorp/terraform-provider-azurerm#24952 `azurerm_postgresql_flexible_server` - expose the `storage_tier` field ([#24892](hashicorp/terraform-provider-azurerm#24892 `azurerm_redis_cache` - support for the `preferred_data_persistence_auth_method` property ([#24370](hashicorp/terraform-provider-azurerm#24370 `azurerm_servicebus_namespace` - support for the `premium_messaging_partitions` property ([#24676](hashicorp/terraform-provider-azurerm#24676 `azurerm_windows_virtual_machine` - the `virtual_machine_scale_set_id` proeprty can now be changed without creating a new resource ([#24768](https://github.com/hashicorp/terraform-provider-azurerm/issues/24768))

BUG FIXES:

* `azurerm_cognitive_deployment` - the `version_upgrade_option` property can not be updated without creating a new resource ([#24922](hashicorp/terraform-provider-azurerm#24922 `azurerm_data_protection_backup_vault` - support or the `soft_delete` and `retention_duration_in_days` properties ([#24775](hashicorp/terraform-provider-azurerm#24775 `azurerm_data_factory_pipeline` - correctly handle incorrect header values ([#24921](hashicorp/terraform-provider-azurerm#24921 `azurerm_kusto_cluster` - `optimized_auto_scale` is now updated after `sku` has been updated ([#24906](hashicorp/terraform-provider-azurerm#24906 `azurerm_key_vault_certificate` - will now only update the `lifetime_action` of the certificate block unless otherwise required ([#24755](hashicorp/terraform-provider-azurerm#24755 `azurerm_linux_virtual_machine_scale_set` - correctly include `public_ip_prefix_id` during updates ([#24939](hashicorp/terraform-provider-azurerm#24939 `azurerm_postgresql_flexible_server` - the `customer_managed_key.key_vault_key_id` property is now required ([#24981](hashicorp/terraform-provider-azurerm#24981 `azurerm_nginx_deployment` - changing the `sku` property now creates a new resource ([#24905](hashicorp/terraform-provider-azurerm#24905 `azurerm_orchestrated_virtual_machine_scale_set` - the `disk_size_gb` and `lun` parameters of `data_disks` are optional now ([#24944](hashicorp/terraform-provider-azurerm#24944 `azurerm_storage_account` - change order of API calls to be GET-then-PUT ratehr then PATCHES ([#23935](hashicorp/terraform-provider-azurerm#23935 `azurerm_storage_account` - improve the validation around the `immutability_policy` being used with `blob_properties` ([#24938](hashicorp/terraform-provider-azurerm#24938 `azurerm_security_center_setting` - prevent a bug when name is `SENTINEL` ([#24497](hashicorp/terraform-provider-azurerm#24497 `azurerm_windows_virtual_machine_scale_set` - correctly include `public_ip_prefix_id` during updates ([#24939](https://github.com/hashicorp/terraform-provider-azurerm/issues/24939))




</pre> </details> </details> <a href="https://infra.ci.jenkins.io/job/updatecli/job/azure/job/main/19/">Jenkins pipeline link</a> </action> </Actions> --- <table> <tr> <td width="77"> <img src="https://www.updatecli.io/images/updatecli.png" alt="Updatecli logo" width="50" height="50"> </td> <td> <p> Created automatically by <a href="https://www.updatecli.io/">Updatecli</a> </p> <details><summary>Options:</summary> <br /> <p>Most of Updatecli configuration is done via <a href="https://www.updatecli.io/docs/prologue/quick-start/">its manifest(s)</a>.</p> <ul> <li>If you close this pull request, Updatecli will automatically reopen it, the next time it runs.</li> <li>If you close this pull request and delete the base branch, Updatecli will automatically recreate it, erasing all previous commits made.</li> </ul> <p> Feel free to report any issues at <a href="https://github.com/updatecli/updatecli/issues">github.com/updatecli/updatecli</a>.<br /> If you find this tool useful, do not hesitate to star <a href="https://github.com/updatecli/updatecli/stargazers">our GitHub repository</a> as a sign of appreciation, and/or to tell us directly on our <a href="https://matrix.to/#/#Updatecli_community:gitter.im">chat</a>! </p> </details> </td> </tr> </table> Co-authored-by: Jenkins Infra Bot (updatecli) <[email protected]>
…icorp#24595) * azurerm_cosmosdb_account - support new property tier * update code * update code * update code * update code * update code * update code
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. |
Service team is requesting this new feature.
API Reference: https://github.com/Azure/azure-rest-api-specs/blob/68030f1c17e0cd5912e1bda17a5f28473e84b5f9/specification/cosmos-db/resource-manager/Microsoft.DocumentDB/stable/2023-04-15/cosmos-db.json#L9891