From 845513e02defdbe35543b0049ce0c954b071c428 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Tue, 23 Jan 2024 17:24:42 +0800 Subject: [PATCH 01/10] azurerm_cosmosdb_account - support new properties --- .../cosmos/cosmosdb_account_resource.go | 38 +++++++++++++++++++ .../cosmos/cosmosdb_account_resource_test.go | 22 ++++++----- website/docs/r/cosmosdb_account.html.markdown | 4 ++ 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index 7740e3d1e5a1..c83daad92c77 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -479,6 +479,13 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { Default: false, }, + "minimal_tls_version": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(cosmosdb.MinimalTlsVersionTlsOneTwo), + ValidateFunc: validation.StringInSlice(cosmosdb.PossibleValuesForMinimalTlsVersion(), false), + }, + "mongo_server_version": { Type: pluginsdk.TypeString, Optional: true, @@ -505,6 +512,12 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { }, }, + "partition_merge_enabled": { + Type: pluginsdk.TypeBool, + Optional: true, + Default: false, + }, + "backup": { Type: pluginsdk.TypeList, Optional: true, @@ -750,8 +763,10 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) enableFreeTier := d.Get("enable_free_tier").(bool) enableAutomaticFailover := d.Get("enable_automatic_failover").(bool) enableMultipleWriteLocations := d.Get("enable_multiple_write_locations").(bool) + partitionMergeEnabled := d.Get("partition_merge_enabled").(bool) enableAnalyticalStorage := d.Get("analytical_storage_enabled").(bool) disableLocalAuthentication := d.Get("local_authentication_disabled").(bool) + minimalTlsVersion := d.Get("minimal_tls_version").(string) r, err := databaseClient.CheckNameExists(ctx, id.DatabaseAccountName) if err != nil { @@ -801,6 +816,7 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) Capabilities: capabilities, VirtualNetworkRules: expandAzureRmCosmosDBAccountVirtualNetworkRules(d), EnableMultipleWriteLocations: utils.Bool(enableMultipleWriteLocations), + EnablePartitionMerge: utils.Bool(partitionMergeEnabled), PublicNetworkAccess: pointer.To(publicNetworkAccess), EnableAnalyticalStorage: utils.Bool(enableAnalyticalStorage), Cors: common.ExpandCosmosCorsRule(d.Get("cors_rule").([]interface{})), @@ -808,6 +824,7 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) NetworkAclBypass: pointer.To(networkByPass), NetworkAclBypassResourceIds: utils.ExpandStringSlice(d.Get("network_acl_bypass_ids").([]interface{})), DisableLocalAuth: utils.Bool(disableLocalAuthentication), + MinimalTlsVersion: pointer.To(cosmosdb.MinimalTlsVersion(minimalTlsVersion)), }, Tags: tags.Expand(t), } @@ -1044,6 +1061,8 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) NetworkAclBypassResourceIds: utils.ExpandStringSlice(d.Get("network_acl_bypass_ids").([]interface{})), DisableLocalAuth: disableLocalAuthentication, BackupPolicy: backup, + EnablePartitionMerge: props.EnablePartitionMerge, + MinimalTlsVersion: pointer.To(cosmosdb.MinimalTlsVersion(d.Get("minimal_tls_version").(string))), }, Tags: t, } @@ -1124,6 +1143,23 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] [SKIP] AzureRM Cosmos DB Account: Updating 'EnableMultipleWriteLocations' [NO CHANGE]") } + // Update the following properties independently after the initial CreateOrUpdate... + if d.HasChange("partition_merge_enabled") { + log.Printf("[INFO] Updating AzureRM Cosmos DB Account: Updating 'EnablePartitionMerge'") + + partitionMergeEnabled := pointer.To(d.Get("partition_merge_enabled").(bool)) + if props.EnablePartitionMerge != partitionMergeEnabled { + account.Properties.EnablePartitionMerge = partitionMergeEnabled + + // Update the database... + if err = resourceCosmosDbAccountApiCreateOrUpdate(client, ctx, *id, account, d); err != nil { + return fmt.Errorf("updating %q EnablePartitionMerge: %+v", id, err) + } + } + } else { + log.Printf("[INFO] [SKIP] AzureRM Cosmos DB Account: Updating 'EnablePartitionMerge' [NO CHANGE]") + } + // determine if any locations have been renamed/priority reordered and remove them updateLocations := false for _, configLoc := range configLocations { @@ -1327,6 +1363,8 @@ func resourceCosmosDbAccountRead(d *pluginsdk.ResourceData, meta interface{}) er d.Set("public_network_access_enabled", pointer.From(props.PublicNetworkAccess) == cosmosdb.PublicNetworkAccessEnabled) d.Set("default_identity_type", props.DefaultIdentity) d.Set("create_mode", pointer.From(props.CreateMode)) + d.Set("partition_merge_enabled", pointer.From(props.EnablePartitionMerge)) + d.Set("minimal_tls_version", pointer.From(props.MinimalTlsVersion)) if v := existing.Model.Properties.IsVirtualNetworkFilterEnabled; v != nil { d.Set("is_virtual_network_filter_enabled", props.IsVirtualNetworkFilterEnabled) diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index fb4f08e5727f..6b96e56e92a9 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -420,7 +420,7 @@ func testAccCosmosDBAccount_updateConsistency(t *testing.T, kind cosmosdb.Databa }, data.ImportStep(), { - Config: r.consistency(data, kind, cosmosdb.DefaultConsistencyLevelStrong, 8, 880), + Config: r.consistency(data, kind, false, cosmosdb.MinimalTlsVersionTlsOneOne, cosmosdb.DefaultConsistencyLevelStrong, 8, 880), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelStrong, 1), }, data.ImportStep(), @@ -430,12 +430,12 @@ func testAccCosmosDBAccount_updateConsistency(t *testing.T, kind cosmosdb.Databa }, data.ImportStep(), { - Config: r.consistency(data, kind, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), + Config: r.consistency(data, kind, true, cosmosdb.MinimalTlsVersionTlsOneTwo, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 1), }, data.ImportStep(), { - Config: r.consistency(data, kind, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 77, 700), + Config: r.consistency(data, kind, false, cosmosdb.MinimalTlsVersionTlsOneTwo, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 77, 700), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 1), }, data.ImportStep(), @@ -1441,7 +1441,7 @@ resource "azurerm_cosmosdb_account" "import" { `, r.basic(data, "GlobalDocumentDB", consistency)) } -func (CosmosDBAccountResource) consistency(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { +func (CosmosDBAccountResource) consistency(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, partitionMergeEnabled bool, minimalTlsVersion cosmosdb.MinimalTlsVersion, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -1453,11 +1453,13 @@ resource "azurerm_resource_group" "test" { } resource "azurerm_cosmosdb_account" "test" { - name = "acctest-ca-%d" - location = azurerm_resource_group.test.location - resource_group_name = azurerm_resource_group.test.name - offer_type = "Standard" - kind = "%s" + name = "acctest-ca-%d" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + offer_type = "Standard" + kind = "%s" + partition_merge_enabled = %t + minimal_tls_version = "%s" consistency_policy { consistency_level = "%s" @@ -1470,7 +1472,7 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 0 } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency), interval, staleness) +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), partitionMergeEnabled, string(minimalTlsVersion), string(consistency), interval, staleness) } func (CosmosDBAccountResource) consistencyMongoDB(data acceptance.TestData, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index 3c30ec3a9563..38f2de9def6d 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -146,6 +146,8 @@ The following arguments are supported: * `enable_automatic_failover` - (Optional) Enable automatic failover for this Cosmos DB account. +* `partition_merge_enabled` - (Optional) Is partition merge on the Cosmos DB account enabled? Defaults to `false`. + * `public_network_access_enabled` - (Optional) Whether or not public network access is allowed for this CosmosDB account. Defaults to `true`. * `capabilities` - (Optional) The capabilities which should be enabled for this Cosmos DB account. Value is a `capabilities` block as defined below. @@ -164,6 +166,8 @@ The following arguments are supported: * `access_key_metadata_writes_enabled` - (Optional) Is write operations on metadata resources (databases, containers, throughput) via account keys enabled? Defaults to `true`. +* `minimal_tls_version` - (Optional) The minimum allowed TLS version. Possible values are `Tls`, `Tls11`, and `Tls12`. Defaults to `Tls12`. + * `mongo_server_version` - (Optional) The Server Version of a MongoDB account. Possible values are `4.2`, `4.0`, `3.6`, and `3.2`. * `network_acl_bypass_for_azure_services` - (Optional) If Azure services can bypass ACLs. Defaults to `false`. From 390bcdf1e665dbaf9ca15002cf8e9e6b7b4aeb69 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 24 Jan 2024 11:41:33 +0800 Subject: [PATCH 02/10] update code --- .../cosmos/cosmosdb_account_resource.go | 21 ++----------------- .../cosmos/cosmosdb_account_resource_test.go | 2 +- 2 files changed, 3 insertions(+), 20 deletions(-) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index c83daad92c77..e4df3a03534d 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -1014,7 +1014,7 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) "capacity", "create_mode", "restore", "key_vault_key_id", "mongo_server_version", "public_network_access_enabled", "ip_range_filter", "offer_type", "is_virtual_network_filter_enabled", "kind", "tags", "enable_free_tier", "enable_automatic_failover", "analytical_storage_enabled", - "local_authentication_disabled") { + "local_authentication_disabled", "partition_merge_enabled", "minimal_tls_version") { updateRequired = true } @@ -1061,7 +1061,7 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) NetworkAclBypassResourceIds: utils.ExpandStringSlice(d.Get("network_acl_bypass_ids").([]interface{})), DisableLocalAuth: disableLocalAuthentication, BackupPolicy: backup, - EnablePartitionMerge: props.EnablePartitionMerge, + EnablePartitionMerge: pointer.To(d.Get("partition_merge_enabled").(bool)), MinimalTlsVersion: pointer.To(cosmosdb.MinimalTlsVersion(d.Get("minimal_tls_version").(string))), }, Tags: t, @@ -1143,23 +1143,6 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) log.Printf("[INFO] [SKIP] AzureRM Cosmos DB Account: Updating 'EnableMultipleWriteLocations' [NO CHANGE]") } - // Update the following properties independently after the initial CreateOrUpdate... - if d.HasChange("partition_merge_enabled") { - log.Printf("[INFO] Updating AzureRM Cosmos DB Account: Updating 'EnablePartitionMerge'") - - partitionMergeEnabled := pointer.To(d.Get("partition_merge_enabled").(bool)) - if props.EnablePartitionMerge != partitionMergeEnabled { - account.Properties.EnablePartitionMerge = partitionMergeEnabled - - // Update the database... - if err = resourceCosmosDbAccountApiCreateOrUpdate(client, ctx, *id, account, d); err != nil { - return fmt.Errorf("updating %q EnablePartitionMerge: %+v", id, err) - } - } - } else { - log.Printf("[INFO] [SKIP] AzureRM Cosmos DB Account: Updating 'EnablePartitionMerge' [NO CHANGE]") - } - // determine if any locations have been renamed/priority reordered and remove them updateLocations := false for _, configLoc := range configLocations { diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index 6b96e56e92a9..7b925911b375 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -430,7 +430,7 @@ func testAccCosmosDBAccount_updateConsistency(t *testing.T, kind cosmosdb.Databa }, data.ImportStep(), { - Config: r.consistency(data, kind, true, cosmosdb.MinimalTlsVersionTlsOneTwo, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), + Config: r.consistency(data, kind, true, cosmosdb.MinimalTlsVersionTlsOneOne, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 1), }, data.ImportStep(), From af3a0ee10f6fa80611fbbd4d994a95c57f06291b Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 24 Jan 2024 11:46:06 +0800 Subject: [PATCH 03/10] update code --- internal/services/cosmos/cosmosdb_account_resource.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index e4df3a03534d..9c7eeef4ac98 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -816,7 +816,7 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) Capabilities: capabilities, VirtualNetworkRules: expandAzureRmCosmosDBAccountVirtualNetworkRules(d), EnableMultipleWriteLocations: utils.Bool(enableMultipleWriteLocations), - EnablePartitionMerge: utils.Bool(partitionMergeEnabled), + EnablePartitionMerge: pointer.To(partitionMergeEnabled), PublicNetworkAccess: pointer.To(publicNetworkAccess), EnableAnalyticalStorage: utils.Bool(enableAnalyticalStorage), Cors: common.ExpandCosmosCorsRule(d.Get("cors_rule").([]interface{})), From d8091239a8cfb856ab13819cc6de9af4aa85275c Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 24 Jan 2024 15:50:43 +0800 Subject: [PATCH 04/10] update code --- .../cosmos/cosmosdb_account_resource.go | 12 +- .../cosmos/cosmosdb_account_resource_test.go | 230 +++++++++++++++++- website/docs/r/cosmosdb_account.html.markdown | 2 +- 3 files changed, 233 insertions(+), 11 deletions(-) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index 9c7eeef4ac98..7480e8c57036 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -482,7 +482,6 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { "minimal_tls_version": { Type: pluginsdk.TypeString, Optional: true, - Default: string(cosmosdb.MinimalTlsVersionTlsOneTwo), ValidateFunc: validation.StringInSlice(cosmosdb.PossibleValuesForMinimalTlsVersion(), false), }, @@ -766,7 +765,6 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) partitionMergeEnabled := d.Get("partition_merge_enabled").(bool) enableAnalyticalStorage := d.Get("analytical_storage_enabled").(bool) disableLocalAuthentication := d.Get("local_authentication_disabled").(bool) - minimalTlsVersion := d.Get("minimal_tls_version").(string) r, err := databaseClient.CheckNameExists(ctx, id.DatabaseAccountName) if err != nil { @@ -824,11 +822,14 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) NetworkAclBypass: pointer.To(networkByPass), NetworkAclBypassResourceIds: utils.ExpandStringSlice(d.Get("network_acl_bypass_ids").([]interface{})), DisableLocalAuth: utils.Bool(disableLocalAuthentication), - MinimalTlsVersion: pointer.To(cosmosdb.MinimalTlsVersion(minimalTlsVersion)), }, Tags: tags.Expand(t), } + if v, ok := d.GetOk("minimal_tls_version"); ok { + account.Properties.MinimalTlsVersion = pointer.To(cosmosdb.MinimalTlsVersion(v.(string))) + } + // These values may not have changed but they need to be in the update params... if v, ok := d.GetOk("default_identity_type"); ok { account.Properties.DefaultIdentity = pointer.To(v.(string)) @@ -1062,11 +1063,14 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) DisableLocalAuth: disableLocalAuthentication, BackupPolicy: backup, EnablePartitionMerge: pointer.To(d.Get("partition_merge_enabled").(bool)), - MinimalTlsVersion: pointer.To(cosmosdb.MinimalTlsVersion(d.Get("minimal_tls_version").(string))), }, Tags: t, } + if v, ok := d.GetOk("minimal_tls_version"); ok { + account.Properties.MinimalTlsVersion = pointer.To(cosmosdb.MinimalTlsVersion(v.(string))) + } + if keyVaultKeyIDRaw, ok := d.GetOk("key_vault_key_id"); ok { keyVaultKey, err := keyVaultParse.ParseOptionallyVersionedNestedItemID(keyVaultKeyIDRaw.(string)) if err != nil { diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index 7b925911b375..8d96bb22a1c2 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -1381,6 +1381,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -1415,6 +1419,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -1507,6 +1515,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency), interval, staleness) } @@ -1602,6 +1614,10 @@ resource "azurerm_cosmosdb_account" "test" { access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1663,6 +1679,10 @@ resource "azurerm_cosmosdb_account" "test" { tags = { ENV = "Test" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1725,6 +1745,10 @@ resource "azurerm_cosmosdb_account" "test" { access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1765,6 +1789,10 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 1 zone_redundant = true } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), data.Locations.Secondary) } @@ -1809,6 +1837,10 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 1 zone_redundant = true } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Locations.Secondary) } @@ -1878,6 +1910,10 @@ resource "azurerm_cosmosdb_account" "test" { } access_key_metadata_writes_enabled = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1943,6 +1979,10 @@ resource "azurerm_cosmosdb_account" "test" { } access_key_metadata_writes_enabled = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2019,6 +2059,10 @@ resource "azurerm_cosmosdb_account" "test" { max_age_in_seconds = 2147483647 } access_key_metadata_writes_enabled = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2091,6 +2135,10 @@ resource "azurerm_cosmosdb_account" "test" { max_age_in_seconds = 2147483647 } access_key_metadata_writes_enabled = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2126,6 +2174,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency)) } @@ -2169,6 +2221,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(consistency)) } @@ -2206,6 +2262,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), capeTf) } @@ -2241,6 +2301,10 @@ resource "azurerm_cosmosdb_account" "test" { location = "%s" failover_priority = 1 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary) } @@ -2302,6 +2366,10 @@ resource "azurerm_cosmosdb_account" "test" { zone_redundant = geo_location.value.zone_redundant } } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.Locations.Primary, data.Locations.Secondary, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -2383,6 +2451,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -2424,6 +2496,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -2456,6 +2532,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -2488,6 +2568,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), enableAnalyticalStorage, string(consistency)) } @@ -2524,6 +2608,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -2586,6 +2674,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -2704,6 +2796,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -2854,6 +2950,10 @@ resource "azurerm_cosmosdb_account" "test" { identity { type = "SystemAssigned" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3007,6 +3107,10 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3160,6 +3264,10 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3207,6 +3315,10 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -3262,6 +3374,10 @@ resource "azurerm_cosmosdb_account" "test" { type = "UserAssigned" identity_ids = [%[4]s] } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, identityResource) } @@ -3310,6 +3426,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -3347,6 +3467,10 @@ resource "azurerm_cosmosdb_account" "test" { retention_in_hours = 10 storage_redundancy = "Geo" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3384,6 +3508,10 @@ resource "azurerm_cosmosdb_account" "test" { retention_in_hours = 8 storage_redundancy = "Local" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3418,6 +3546,10 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3454,6 +3586,10 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3520,6 +3656,10 @@ resource "azurerm_cosmosdb_account" "test" { network_acl_bypass_for_azure_services = true network_acl_bypass_ids = [azurerm_synapse_workspace.test.id] + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.basicWithNetworkBypassTemplate(data), data.RandomInteger, string(kind), string(consistency)) } @@ -3544,6 +3684,9 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 0 } + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.basicWithNetworkBypassTemplate(data), data.RandomInteger, string(kind), string(consistency)) } @@ -3578,7 +3721,8 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities + capabilities, + minimal_tls_version ] } } @@ -3620,6 +3764,10 @@ resource "azurerm_cosmosdb_account" "test" { capabilities { name = "EnableMongo16MBDocumentSupport" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -3654,10 +3802,10 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities + capabilities, + minimal_tls_version ] } - } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -3720,7 +3868,8 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities + capabilities, + minimal_tls_version ] } } @@ -3761,7 +3910,8 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities + capabilities, + minimal_tls_version ] } } @@ -3796,6 +3946,10 @@ resource "azurerm_cosmosdb_account" "test" { } local_authentication_disabled = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3831,6 +3985,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(schemaType), string(consistency)) } @@ -3866,6 +4024,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), totalThroughputLimit, string(consistency)) } @@ -3897,6 +4059,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, string(consistency)) } @@ -3932,6 +4098,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, string(consistency)) } @@ -3974,6 +4144,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, identityType, string(consistency)) } @@ -4009,6 +4183,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -4047,6 +4225,10 @@ resource "azurerm_cosmosdb_account" "test1" { backup { type = "Continuous" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "test" { @@ -4111,7 +4293,8 @@ resource "azurerm_cosmosdb_account" "test" { // As "restore_timestamp_in_utc" is retrieved dynamically, so it would cause diff when tf plan. So we have to ignore it here. lifecycle { ignore_changes = [ - restore.0.restore_timestamp_in_utc + restore.0.restore_timestamp_in_utc, + minimal_tls_version ] } } @@ -4155,6 +4338,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4196,6 +4383,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4237,6 +4428,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4278,6 +4473,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4328,6 +4527,10 @@ resource "azurerm_cosmosdb_account" "test" { environment = "%[2]s", created_date = "2023-07-18" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, tag) } @@ -4335,45 +4538,60 @@ resource "azurerm_cosmosdb_account" "test" { func (r CosmosDBAccountResource) withoutMaxAgeInSeconds(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, consistency cosmosdb.DefaultConsistencyLevel) string { return fmt.Sprintf(` %[1]s + resource "azurerm_cosmosdb_account" "test" { name = "acctest-ca-%[2]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name offer_type = "Standard" kind = "%[3]s" + consistency_policy { consistency_level = "%[4]s" max_interval_in_seconds = 300 max_staleness_prefix = 170000 } + is_virtual_network_filter_enabled = true + virtual_network_rule { id = azurerm_subnet.subnet1.id } + virtual_network_rule { id = azurerm_subnet.subnet2.id } + enable_multiple_write_locations = true + geo_location { location = azurerm_resource_group.test.location failover_priority = 0 } + geo_location { location = "%[5]s" failover_priority = 1 } + geo_location { location = "%[6]s" failover_priority = 2 } + cors_rule { allowed_origins = ["http://www.example.com"] exposed_headers = ["x-tempo-*"] allowed_headers = ["x-tempo-*"] allowed_methods = ["GET", "PUT"] } + access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index 38f2de9def6d..17177cd3b52a 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -166,7 +166,7 @@ The following arguments are supported: * `access_key_metadata_writes_enabled` - (Optional) Is write operations on metadata resources (databases, containers, throughput) via account keys enabled? Defaults to `true`. -* `minimal_tls_version` - (Optional) The minimum allowed TLS version. Possible values are `Tls`, `Tls11`, and `Tls12`. Defaults to `Tls12`. +* `minimal_tls_version` - (Optional) The minimum allowed TLS version. Possible values are `Tls`, `Tls11`, and `Tls12`. * `mongo_server_version` - (Optional) The Server Version of a MongoDB account. Possible values are `4.2`, `4.0`, `3.6`, and `3.2`. From 354862dc235421eaf93b0e97d8a742b5ea09d782 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 24 Jan 2024 16:32:18 +0800 Subject: [PATCH 05/10] update code --- ...cosmosdb_account_resource_failover_test.go | 28 +++++++++++++++++++ .../cosmosdb_cassandra_table_resource_test.go | 4 +++ ...cosmosdb_gremlin_database_resource_test.go | 4 +++ .../cosmosdb_gremlin_graph_resource_test.go | 4 +++ ...sdb_mongo_role_definition_resource_test.go | 4 +++ ...sdb_mongo_user_definition_resource_test.go | 4 +++ ...smosdb_notebook_workspace_resource_test.go | 4 +++ ...able_database_accounts_data_source_test.go | 4 +++ ...sdb_sql_dedicated_gateway_resource_test.go | 4 +++ .../cosmosdb_sql_function_resource_test.go | 4 +++ ...mosdb_sql_role_assignment_resource_test.go | 4 +++ ...mosdb_sql_role_definition_resource_test.go | 4 +++ ...osdb_sql_stored_procedure_resource_test.go | 4 +++ .../cosmosdb_sql_trigger_resource_test.go | 4 +++ .../services/iothub/iothub_resource_test.go | 4 +++ ..._cosmosdb_data_connection_resource_test.go | 8 ++++++ ..._app_cosmosdb_association_resource_test.go | 4 +++ 17 files changed, 96 insertions(+) diff --git a/internal/services/cosmos/cosmosdb_account_resource_failover_test.go b/internal/services/cosmos/cosmosdb_account_resource_failover_test.go index a4a80c151290..201324238817 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_failover_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_failover_test.go @@ -136,6 +136,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -167,6 +171,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -196,6 +204,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -225,6 +237,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -259,6 +275,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -288,6 +308,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -324,6 +348,10 @@ resource "azurerm_cosmosdb_account" "test" { location = "%s" failover_priority = 1 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Locations.Secondary) } diff --git a/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go b/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go index 28491b0d5d54..f6fc822d5a38 100644 --- a/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go +++ b/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go @@ -224,6 +224,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_cassandra_keyspace" "test" { diff --git a/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go b/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go index cc9ace689b70..ce3c57466d50 100644 --- a/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go +++ b/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go @@ -233,6 +233,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, capeTf) } diff --git a/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go b/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go index a9b19567fa8d..3d442e95a6d5 100644 --- a/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go +++ b/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go @@ -522,6 +522,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_gremlin_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go b/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go index 80d2a87296c0..e46ab45b647f 100644 --- a/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go @@ -309,6 +309,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go b/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go index d7bca3ddf5e3..af4fa467f018 100644 --- a/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go @@ -198,6 +198,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go b/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go index d8cbd053ab20..2829debe6316 100644 --- a/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go +++ b/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go @@ -90,6 +90,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go b/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go index 95c99f4671e9..a34be8248fc0 100644 --- a/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go +++ b/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go @@ -62,6 +62,10 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go index 756c01434023..18602273f359 100644 --- a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go @@ -114,6 +114,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_sql_function_resource_test.go b/internal/services/cosmos/cosmosdb_sql_function_resource_test.go index 91dbe2d5d590..90e6fb230b58 100644 --- a/internal/services/cosmos/cosmosdb_sql_function_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_function_resource_test.go @@ -116,6 +116,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go b/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go index 2602f0c74bfb..c7c349a4e85e 100644 --- a/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go @@ -138,6 +138,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_role_definition" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go b/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go index 6ee21849990d..590e111febb0 100644 --- a/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go @@ -154,6 +154,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go b/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go index 8b5292535d37..4fdd2739ec83 100644 --- a/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go @@ -96,6 +96,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go b/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go index 9543e92d2d7c..7ab4280cd6d0 100644 --- a/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go @@ -116,6 +116,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/iothub/iothub_resource_test.go b/internal/services/iothub/iothub_resource_test.go index 70d4e9ce8d02..db4de450d4fb 100644 --- a/internal/services/iothub/iothub_resource_test.go +++ b/internal/services/iothub/iothub_resource_test.go @@ -2145,6 +2145,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.endpoint.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go b/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go index 6fece37f4246..9a331e5ff226 100644 --- a/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go @@ -213,6 +213,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test2.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -335,6 +339,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go index 6f4edb58e5c2..b595d82674fc 100644 --- a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go +++ b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go @@ -593,6 +593,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_cassandra_keyspace" "test" { From 8dd4f200e909f27ca92e0e6ceff9f41cce1c55db Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Wed, 24 Jan 2024 17:00:45 +0800 Subject: [PATCH 06/10] update code --- examples/cosmos-db/basic/main.tf | 4 ++++ examples/cosmos-db/customer-managed-key/main.tf | 4 ++++ examples/cosmos-db/failover/main.tf | 4 ++++ .../private-endpoint/cosmos-db/mongodb/main.tf | 4 ++++ ...ub_endpoint_cosmosdb_account_resource_test.go | 4 ++++ .../advanced_threat_protection_resource_test.go | 4 ++++ ...ervice_connector_app_service_resource_test.go | 8 ++++++++ ...rvice_connector_function_app_resource_test.go | 4 ++++ ...rvice_connector_spring_cloud_resource_test.go | 8 ++++++++ ...oud_app_cosmosdb_association_resource_test.go | 16 ++++++++++++++++ ...am_analytics_output_cosmosdb_resource_test.go | 4 ++++ .../docs/r/app_service_connection.html.markdown | 4 ++++ website/docs/r/cosmosdb_account.html.markdown | 8 ++++++++ .../r/cosmosdb_cassandra_keyspace.html.markdown | 4 ++++ .../r/cosmosdb_cassandra_table.html.markdown | 4 ++++ .../cosmosdb_mongo_role_definition.html.markdown | 4 ++++ .../cosmosdb_mongo_user_definition.html.markdown | 4 ++++ .../r/cosmosdb_notebook_workspace.html.markdown | 4 ++++ .../cosmosdb_sql_dedicated_gateway.html.markdown | 4 ++++ .../r/cosmosdb_sql_role_assignment.html.markdown | 4 ++++ .../r/cosmosdb_sql_role_definition.html.markdown | 4 ++++ .../docs/r/function_app_connection.html.markdown | 4 ++++ ...othub_endpoint_cosmosdb_account.html.markdown | 4 ++++ .../kusto_cosmosdb_data_connection.html.markdown | 4 ++++ ..._cloud_app_cosmosdb_association.html.markdown | 4 ++++ .../docs/r/spring_cloud_connection.html.markdown | 4 ++++ ...tream_analytics_output_cosmosdb.html.markdown | 4 ++++ 27 files changed, 132 insertions(+) diff --git a/examples/cosmos-db/basic/main.tf b/examples/cosmos-db/basic/main.tf index 45310f274b4f..e3577f558b9e 100644 --- a/examples/cosmos-db/basic/main.tf +++ b/examples/cosmos-db/basic/main.tf @@ -27,4 +27,8 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } diff --git a/examples/cosmos-db/customer-managed-key/main.tf b/examples/cosmos-db/customer-managed-key/main.tf index 7c2ddc0fd201..e8f87533d4ed 100644 --- a/examples/cosmos-db/customer-managed-key/main.tf +++ b/examples/cosmos-db/customer-managed-key/main.tf @@ -81,4 +81,8 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } diff --git a/examples/cosmos-db/failover/main.tf b/examples/cosmos-db/failover/main.tf index 33ee23a70215..845bf9cf8901 100644 --- a/examples/cosmos-db/failover/main.tf +++ b/examples/cosmos-db/failover/main.tf @@ -38,4 +38,8 @@ resource "azurerm_cosmosdb_account" "example" { location = var.alt_location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } diff --git a/examples/private-endpoint/cosmos-db/mongodb/main.tf b/examples/private-endpoint/cosmos-db/mongodb/main.tf index 7e15a86b0b49..fa70aece9ffe 100644 --- a/examples/private-endpoint/cosmos-db/mongodb/main.tf +++ b/examples/private-endpoint/cosmos-db/mongodb/main.tf @@ -55,6 +55,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_private_endpoint" "example" { diff --git a/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go b/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go index 31bc925c0f6b..5433cd90b65b 100644 --- a/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go +++ b/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go @@ -393,6 +393,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.endpoint.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/securitycenter/advanced_threat_protection_resource_test.go b/internal/services/securitycenter/advanced_threat_protection_resource_test.go index e682dda3c3a8..2ab52201eaf6 100644 --- a/internal/services/securitycenter/advanced_threat_protection_resource_test.go +++ b/internal/services/securitycenter/advanced_threat_protection_resource_test.go @@ -211,6 +211,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } %s diff --git a/internal/services/serviceconnector/service_connector_app_service_resource_test.go b/internal/services/serviceconnector/service_connector_app_service_resource_test.go index df01ca40af6a..1e572acf74c4 100644 --- a/internal/services/serviceconnector/service_connector_app_service_resource_test.go +++ b/internal/services/serviceconnector/service_connector_app_service_resource_test.go @@ -470,6 +470,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -583,6 +587,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/serviceconnector/service_connector_function_app_resource_test.go b/internal/services/serviceconnector/service_connector_function_app_resource_test.go index 3e955d80cde3..a1aa1dcc16b0 100644 --- a/internal/services/serviceconnector/service_connector_function_app_resource_test.go +++ b/internal/services/serviceconnector/service_connector_function_app_resource_test.go @@ -463,6 +463,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go index 8ab721f6ba9d..bfaa9ca5c2a3 100644 --- a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go @@ -248,6 +248,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -529,6 +533,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go index b595d82674fc..3e461db89ad3 100644 --- a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go +++ b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go @@ -649,6 +649,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_gremlin_database" "test" { @@ -717,6 +721,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "test" { @@ -765,6 +773,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -813,6 +825,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go index 8edc14c49e6d..f76dddca4d2f 100644 --- a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go @@ -205,6 +205,10 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/website/docs/r/app_service_connection.html.markdown b/website/docs/r/app_service_connection.html.markdown index 2301f7df271c..e187c7e5a008 100644 --- a/website/docs/r/app_service_connection.html.markdown +++ b/website/docs/r/app_service_connection.html.markdown @@ -35,6 +35,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index 17177cd3b52a..bbe90be0cc58 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -63,6 +63,10 @@ resource "azurerm_cosmosdb_account" "db" { location = "westus" failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } ``` @@ -100,6 +104,10 @@ resource "azurerm_cosmosdb_account" "example" { type = "UserAssigned" identity_ids = [azurerm_user_assigned_identity.example.id] } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } ``` ## Argument Reference diff --git a/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown b/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown index 0d449c6c6b72..7b204c734a86 100644 --- a/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown +++ b/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown @@ -36,6 +36,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_cassandra_keyspace" "example" { diff --git a/website/docs/r/cosmosdb_cassandra_table.html.markdown b/website/docs/r/cosmosdb_cassandra_table.html.markdown index 09200c9fbc22..839709373e45 100644 --- a/website/docs/r/cosmosdb_cassandra_table.html.markdown +++ b/website/docs/r/cosmosdb_cassandra_table.html.markdown @@ -36,6 +36,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_cassandra_keyspace" "example" { diff --git a/website/docs/r/cosmosdb_mongo_role_definition.html.markdown b/website/docs/r/cosmosdb_mongo_role_definition.html.markdown index 35b27cfa9531..f71356847583 100644 --- a/website/docs/r/cosmosdb_mongo_role_definition.html.markdown +++ b/website/docs/r/cosmosdb_mongo_role_definition.html.markdown @@ -41,6 +41,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "example" { diff --git a/website/docs/r/cosmosdb_mongo_user_definition.html.markdown b/website/docs/r/cosmosdb_mongo_user_definition.html.markdown index 94aed01029f0..abe8132ce8de 100644 --- a/website/docs/r/cosmosdb_mongo_user_definition.html.markdown +++ b/website/docs/r/cosmosdb_mongo_user_definition.html.markdown @@ -41,6 +41,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_mongo_database" "example" { diff --git a/website/docs/r/cosmosdb_notebook_workspace.html.markdown b/website/docs/r/cosmosdb_notebook_workspace.html.markdown index 70fd8adffbda..679923f6e921 100644 --- a/website/docs/r/cosmosdb_notebook_workspace.html.markdown +++ b/website/docs/r/cosmosdb_notebook_workspace.html.markdown @@ -39,6 +39,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_notebook_workspace" "example" { diff --git a/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown b/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown index 716b01b87220..ddb0362ded3b 100644 --- a/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown +++ b/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown @@ -33,6 +33,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_dedicated_gateway" "example" { diff --git a/website/docs/r/cosmosdb_sql_role_assignment.html.markdown b/website/docs/r/cosmosdb_sql_role_assignment.html.markdown index 83792582f971..f9c28e6aa9c0 100644 --- a/website/docs/r/cosmosdb_sql_role_assignment.html.markdown +++ b/website/docs/r/cosmosdb_sql_role_assignment.html.markdown @@ -35,6 +35,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_role_definition" "example" { diff --git a/website/docs/r/cosmosdb_sql_role_definition.html.markdown b/website/docs/r/cosmosdb_sql_role_definition.html.markdown index 3ecd6e61669c..ef92512a0417 100644 --- a/website/docs/r/cosmosdb_sql_role_definition.html.markdown +++ b/website/docs/r/cosmosdb_sql_role_definition.html.markdown @@ -35,6 +35,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_role_definition" "example" { diff --git a/website/docs/r/function_app_connection.html.markdown b/website/docs/r/function_app_connection.html.markdown index b69f434874b7..48821e873bb2 100644 --- a/website/docs/r/function_app_connection.html.markdown +++ b/website/docs/r/function_app_connection.html.markdown @@ -35,6 +35,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown b/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown index 1a89224d2636..4e656ea36b0c 100644 --- a/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown +++ b/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown @@ -50,6 +50,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/kusto_cosmosdb_data_connection.html.markdown b/website/docs/r/kusto_cosmosdb_data_connection.html.markdown index 5f7bff78438a..7693dcecf494 100644 --- a/website/docs/r/kusto_cosmosdb_data_connection.html.markdown +++ b/website/docs/r/kusto_cosmosdb_data_connection.html.markdown @@ -47,6 +47,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown b/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown index 8e5f486b432d..79edfa3e2aee 100644 --- a/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown +++ b/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown @@ -45,6 +45,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_spring_cloud_app_cosmosdb_association" "example" { diff --git a/website/docs/r/spring_cloud_connection.html.markdown b/website/docs/r/spring_cloud_connection.html.markdown index d683578d72eb..eb31d011b8f1 100644 --- a/website/docs/r/spring_cloud_connection.html.markdown +++ b/website/docs/r/spring_cloud_connection.html.markdown @@ -35,6 +35,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/stream_analytics_output_cosmosdb.html.markdown b/website/docs/r/stream_analytics_output_cosmosdb.html.markdown index 5033b7807101..80aae19b01cd 100644 --- a/website/docs/r/stream_analytics_output_cosmosdb.html.markdown +++ b/website/docs/r/stream_analytics_output_cosmosdb.html.markdown @@ -40,6 +40,10 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } + + lifecycle { + ignore_changes = [minimal_tls_version] + } } resource "azurerm_cosmosdb_sql_database" "example" { From dd7050d7b45e78ea40c61f30aec27298c9a7859b Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Mon, 29 Jan 2024 09:34:42 +0800 Subject: [PATCH 07/10] update code --- internal/services/cosmos/cosmosdb_account_resource.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index 7480e8c57036..1d86feb40d42 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -479,6 +479,7 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { Default: false, }, + // The `minimalTlsVersion` of the source CosmosDB Account is `Tls12` when it isn't set in the request payload but the `minimalTlsVersion` of the restored CosmosDB Account is `Tls` when it isn't set in the request payload. So the default value isn't added in the schema. "minimal_tls_version": { Type: pluginsdk.TypeString, Optional: true, From 7d9ff4b88fbc8dabb2fdaba9252f00e08b8e460d Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Tue, 30 Jan 2024 10:44:42 +0800 Subject: [PATCH 08/10] update cpde --- examples/cosmos-db/basic/main.tf | 4 - .../cosmos-db/customer-managed-key/main.tf | 4 - examples/cosmos-db/failover/main.tf | 4 - .../cosmos-db/mongodb/main.tf | 4 - ...cosmosdb_account_resource_failover_test.go | 28 --- .../cosmos/cosmosdb_account_resource_test.go | 204 ------------------ .../cosmosdb_cassandra_table_resource_test.go | 4 - ...cosmosdb_gremlin_database_resource_test.go | 4 - .../cosmosdb_gremlin_graph_resource_test.go | 4 - ...sdb_mongo_role_definition_resource_test.go | 4 - ...sdb_mongo_user_definition_resource_test.go | 4 - ...smosdb_notebook_workspace_resource_test.go | 4 - ...able_database_accounts_data_source_test.go | 4 - ...sdb_sql_dedicated_gateway_resource_test.go | 4 - .../cosmosdb_sql_function_resource_test.go | 4 - ...mosdb_sql_role_assignment_resource_test.go | 4 - ...mosdb_sql_role_definition_resource_test.go | 4 - ...osdb_sql_stored_procedure_resource_test.go | 4 - .../cosmosdb_sql_trigger_resource_test.go | 4 - ...endpoint_cosmosdb_account_resource_test.go | 4 - .../services/iothub/iothub_resource_test.go | 4 - ..._cosmosdb_data_connection_resource_test.go | 8 - ...dvanced_threat_protection_resource_test.go | 4 - ...ice_connector_app_service_resource_test.go | 8 - ...ce_connector_function_app_resource_test.go | 4 - ...ce_connector_spring_cloud_resource_test.go | 8 - ..._app_cosmosdb_association_resource_test.go | 20 -- ...analytics_output_cosmosdb_resource_test.go | 4 - .../r/app_service_connection.html.markdown | 4 - website/docs/r/cosmosdb_account.html.markdown | 8 - .../cosmosdb_cassandra_keyspace.html.markdown | 4 - .../r/cosmosdb_cassandra_table.html.markdown | 4 - ...smosdb_mongo_role_definition.html.markdown | 4 - ...smosdb_mongo_user_definition.html.markdown | 4 - .../cosmosdb_notebook_workspace.html.markdown | 4 - ...smosdb_sql_dedicated_gateway.html.markdown | 4 - ...cosmosdb_sql_role_assignment.html.markdown | 4 - ...cosmosdb_sql_role_definition.html.markdown | 4 - .../r/function_app_connection.html.markdown | 4 - ...ub_endpoint_cosmosdb_account.html.markdown | 4 - ...sto_cosmosdb_data_connection.html.markdown | 4 - ...oud_app_cosmosdb_association.html.markdown | 4 - .../r/spring_cloud_connection.html.markdown | 4 - ...am_analytics_output_cosmosdb.html.markdown | 4 - 44 files changed, 432 deletions(-) diff --git a/examples/cosmos-db/basic/main.tf b/examples/cosmos-db/basic/main.tf index e3577f558b9e..45310f274b4f 100644 --- a/examples/cosmos-db/basic/main.tf +++ b/examples/cosmos-db/basic/main.tf @@ -27,8 +27,4 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } diff --git a/examples/cosmos-db/customer-managed-key/main.tf b/examples/cosmos-db/customer-managed-key/main.tf index e8f87533d4ed..7c2ddc0fd201 100644 --- a/examples/cosmos-db/customer-managed-key/main.tf +++ b/examples/cosmos-db/customer-managed-key/main.tf @@ -81,8 +81,4 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } diff --git a/examples/cosmos-db/failover/main.tf b/examples/cosmos-db/failover/main.tf index 845bf9cf8901..33ee23a70215 100644 --- a/examples/cosmos-db/failover/main.tf +++ b/examples/cosmos-db/failover/main.tf @@ -38,8 +38,4 @@ resource "azurerm_cosmosdb_account" "example" { location = var.alt_location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } diff --git a/examples/private-endpoint/cosmos-db/mongodb/main.tf b/examples/private-endpoint/cosmos-db/mongodb/main.tf index fa70aece9ffe..7e15a86b0b49 100644 --- a/examples/private-endpoint/cosmos-db/mongodb/main.tf +++ b/examples/private-endpoint/cosmos-db/mongodb/main.tf @@ -55,10 +55,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_private_endpoint" "example" { diff --git a/internal/services/cosmos/cosmosdb_account_resource_failover_test.go b/internal/services/cosmos/cosmosdb_account_resource_failover_test.go index 201324238817..a4a80c151290 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_failover_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_failover_test.go @@ -136,10 +136,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -171,10 +167,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -204,10 +196,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -237,10 +225,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -275,10 +259,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -308,10 +288,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -348,10 +324,6 @@ resource "azurerm_cosmosdb_account" "test" { location = "%s" failover_priority = 1 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Locations.Secondary) } diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index 8d96bb22a1c2..f0a221a93811 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -1381,10 +1381,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -1419,10 +1415,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -1515,10 +1507,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency), interval, staleness) } @@ -1614,10 +1602,6 @@ resource "azurerm_cosmosdb_account" "test" { access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1679,10 +1663,6 @@ resource "azurerm_cosmosdb_account" "test" { tags = { ENV = "Test" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1745,10 +1725,6 @@ resource "azurerm_cosmosdb_account" "test" { access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1789,10 +1765,6 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 1 zone_redundant = true } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), data.Locations.Secondary) } @@ -1837,10 +1809,6 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 1 zone_redundant = true } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.Locations.Secondary) } @@ -1910,10 +1878,6 @@ resource "azurerm_cosmosdb_account" "test" { } access_key_metadata_writes_enabled = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -1979,10 +1943,6 @@ resource "azurerm_cosmosdb_account" "test" { } access_key_metadata_writes_enabled = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2059,10 +2019,6 @@ resource "azurerm_cosmosdb_account" "test" { max_age_in_seconds = 2147483647 } access_key_metadata_writes_enabled = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2135,10 +2091,6 @@ resource "azurerm_cosmosdb_account" "test" { max_age_in_seconds = 2147483647 } access_key_metadata_writes_enabled = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(consistency), data.Locations.Secondary, data.Locations.Ternary) } @@ -2174,10 +2126,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency)) } @@ -2221,10 +2169,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(consistency)) } @@ -2262,10 +2206,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), capeTf) } @@ -2301,10 +2241,6 @@ resource "azurerm_cosmosdb_account" "test" { location = "%s" failover_priority = 1 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary) } @@ -2366,10 +2302,6 @@ resource "azurerm_cosmosdb_account" "test" { zone_redundant = geo_location.value.zone_redundant } } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.Locations.Primary, data.Locations.Secondary, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -2451,10 +2383,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -2496,10 +2424,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -2532,10 +2456,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -2568,10 +2488,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), enableAnalyticalStorage, string(consistency)) } @@ -2608,10 +2524,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -2674,10 +2586,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -2796,10 +2704,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -2950,10 +2854,6 @@ resource "azurerm_cosmosdb_account" "test" { identity { type = "SystemAssigned" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3107,10 +3007,6 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3264,10 +3160,6 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomString, data.RandomString, data.RandomInteger, string(kind), string(consistency)) } @@ -3315,10 +3207,6 @@ resource "azurerm_cosmosdb_account" "test" { azurerm_user_assigned_identity.test.id ] } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -3374,10 +3262,6 @@ resource "azurerm_cosmosdb_account" "test" { type = "UserAssigned" identity_ids = [%[4]s] } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, identityResource) } @@ -3426,10 +3310,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } @@ -3467,10 +3347,6 @@ resource "azurerm_cosmosdb_account" "test" { retention_in_hours = 10 storage_redundancy = "Geo" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3508,10 +3384,6 @@ resource "azurerm_cosmosdb_account" "test" { retention_in_hours = 8 storage_redundancy = "Local" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3546,10 +3418,6 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3586,10 +3454,6 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3656,10 +3520,6 @@ resource "azurerm_cosmosdb_account" "test" { network_acl_bypass_for_azure_services = true network_acl_bypass_ids = [azurerm_synapse_workspace.test.id] - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.basicWithNetworkBypassTemplate(data), data.RandomInteger, string(kind), string(consistency)) } @@ -3683,10 +3543,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.basicWithNetworkBypassTemplate(data), data.RandomInteger, string(kind), string(consistency)) } @@ -3764,10 +3620,6 @@ resource "azurerm_cosmosdb_account" "test" { capabilities { name = "EnableMongo16MBDocumentSupport" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) } @@ -3946,10 +3798,6 @@ resource "azurerm_cosmosdb_account" "test" { } local_authentication_disabled = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -3985,10 +3833,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(schemaType), string(consistency)) } @@ -4024,10 +3868,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), totalThroughputLimit, string(consistency)) } @@ -4059,10 +3899,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, string(consistency)) } @@ -4098,10 +3934,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, string(consistency)) } @@ -4144,10 +3976,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), defaultIdentity, identityType, string(consistency)) } @@ -4183,10 +4011,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), string(consistency)) } @@ -4225,10 +4049,6 @@ resource "azurerm_cosmosdb_account" "test1" { backup { type = "Continuous" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "test" { @@ -4338,10 +4158,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4383,10 +4199,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4428,10 +4240,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4473,10 +4281,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.vNetFiltersPreReqs(data), data.RandomInteger) } @@ -4527,10 +4331,6 @@ resource "azurerm_cosmosdb_account" "test" { environment = "%[2]s", created_date = "2023-07-18" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, tag) } @@ -4588,10 +4388,6 @@ resource "azurerm_cosmosdb_account" "test" { access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, r.completePreReqs(data), data.RandomInteger, string(kind), string(consistency), data.Locations.Secondary, data.Locations.Ternary) } diff --git a/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go b/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go index f6fc822d5a38..28491b0d5d54 100644 --- a/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go +++ b/internal/services/cosmos/cosmosdb_cassandra_table_resource_test.go @@ -224,10 +224,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_cassandra_keyspace" "test" { diff --git a/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go b/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go index ce3c57466d50..cc9ace689b70 100644 --- a/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go +++ b/internal/services/cosmos/cosmosdb_gremlin_database_resource_test.go @@ -233,10 +233,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, capeTf) } diff --git a/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go b/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go index 3d442e95a6d5..a9b19567fa8d 100644 --- a/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go +++ b/internal/services/cosmos/cosmosdb_gremlin_graph_resource_test.go @@ -522,10 +522,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_gremlin_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go b/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go index e46ab45b647f..80d2a87296c0 100644 --- a/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_mongo_role_definition_resource_test.go @@ -309,10 +309,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go b/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go index af4fa467f018..d7bca3ddf5e3 100644 --- a/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_mongo_user_definition_resource_test.go @@ -198,10 +198,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go b/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go index 2829debe6316..d8cbd053ab20 100644 --- a/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go +++ b/internal/services/cosmos/cosmosdb_notebook_workspace_resource_test.go @@ -90,10 +90,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go b/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go index a34be8248fc0..95c99f4671e9 100644 --- a/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go +++ b/internal/services/cosmos/cosmosdb_restorable_database_accounts_data_source_test.go @@ -62,10 +62,6 @@ resource "azurerm_cosmosdb_account" "test" { backup { type = "Continuous" } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go index 18602273f359..756c01434023 100644 --- a/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_dedicated_gateway_resource_test.go @@ -114,10 +114,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_sql_function_resource_test.go b/internal/services/cosmos/cosmosdb_sql_function_resource_test.go index 90e6fb230b58..91dbe2d5d590 100644 --- a/internal/services/cosmos/cosmosdb_sql_function_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_function_resource_test.go @@ -116,10 +116,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go b/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go index c7c349a4e85e..2602f0c74bfb 100644 --- a/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_role_assignment_resource_test.go @@ -138,10 +138,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_role_definition" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go b/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go index 590e111febb0..6ee21849990d 100644 --- a/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_role_definition_resource_test.go @@ -154,10 +154,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } diff --git a/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go b/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go index 4fdd2739ec83..8b5292535d37 100644 --- a/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_stored_procedure_resource_test.go @@ -96,10 +96,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go b/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go index 7ab4280cd6d0..9543e92d2d7c 100644 --- a/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go +++ b/internal/services/cosmos/cosmosdb_sql_trigger_resource_test.go @@ -116,10 +116,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go b/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go index 5433cd90b65b..31bc925c0f6b 100644 --- a/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go +++ b/internal/services/iothub/iothub_endpoint_cosmosdb_account_resource_test.go @@ -393,10 +393,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.endpoint.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/iothub/iothub_resource_test.go b/internal/services/iothub/iothub_resource_test.go index db4de450d4fb..70d4e9ce8d02 100644 --- a/internal/services/iothub/iothub_resource_test.go +++ b/internal/services/iothub/iothub_resource_test.go @@ -2145,10 +2145,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.endpoint.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go b/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go index 9a331e5ff226..6fece37f4246 100644 --- a/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go +++ b/internal/services/kusto/kusto_cosmosdb_data_connection_resource_test.go @@ -213,10 +213,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test2.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -339,10 +335,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/securitycenter/advanced_threat_protection_resource_test.go b/internal/services/securitycenter/advanced_threat_protection_resource_test.go index 2ab52201eaf6..e682dda3c3a8 100644 --- a/internal/services/securitycenter/advanced_threat_protection_resource_test.go +++ b/internal/services/securitycenter/advanced_threat_protection_resource_test.go @@ -211,10 +211,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } %s diff --git a/internal/services/serviceconnector/service_connector_app_service_resource_test.go b/internal/services/serviceconnector/service_connector_app_service_resource_test.go index 1e572acf74c4..df01ca40af6a 100644 --- a/internal/services/serviceconnector/service_connector_app_service_resource_test.go +++ b/internal/services/serviceconnector/service_connector_app_service_resource_test.go @@ -470,10 +470,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -587,10 +583,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/serviceconnector/service_connector_function_app_resource_test.go b/internal/services/serviceconnector/service_connector_function_app_resource_test.go index a1aa1dcc16b0..3e955d80cde3 100644 --- a/internal/services/serviceconnector/service_connector_function_app_resource_test.go +++ b/internal/services/serviceconnector/service_connector_function_app_resource_test.go @@ -463,10 +463,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go index bfaa9ca5c2a3..8ab721f6ba9d 100644 --- a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go @@ -248,10 +248,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -533,10 +529,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go index 3e461db89ad3..6f4edb58e5c2 100644 --- a/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go +++ b/internal/services/springcloud/spring_cloud_app_cosmosdb_association_resource_test.go @@ -593,10 +593,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_cassandra_keyspace" "test" { @@ -649,10 +645,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_gremlin_database" "test" { @@ -721,10 +713,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "test" { @@ -773,10 +761,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { @@ -825,10 +809,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger) } diff --git a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go index f76dddca4d2f..8edc14c49e6d 100644 --- a/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go +++ b/internal/services/streamanalytics/stream_analytics_output_cosmosdb_resource_test.go @@ -205,10 +205,6 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "test" { diff --git a/website/docs/r/app_service_connection.html.markdown b/website/docs/r/app_service_connection.html.markdown index e187c7e5a008..2301f7df271c 100644 --- a/website/docs/r/app_service_connection.html.markdown +++ b/website/docs/r/app_service_connection.html.markdown @@ -35,10 +35,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index bbe90be0cc58..17177cd3b52a 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -63,10 +63,6 @@ resource "azurerm_cosmosdb_account" "db" { location = "westus" failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } ``` @@ -104,10 +100,6 @@ resource "azurerm_cosmosdb_account" "example" { type = "UserAssigned" identity_ids = [azurerm_user_assigned_identity.example.id] } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } ``` ## Argument Reference diff --git a/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown b/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown index 7b204c734a86..0d449c6c6b72 100644 --- a/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown +++ b/website/docs/r/cosmosdb_cassandra_keyspace.html.markdown @@ -36,10 +36,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_cassandra_keyspace" "example" { diff --git a/website/docs/r/cosmosdb_cassandra_table.html.markdown b/website/docs/r/cosmosdb_cassandra_table.html.markdown index 839709373e45..09200c9fbc22 100644 --- a/website/docs/r/cosmosdb_cassandra_table.html.markdown +++ b/website/docs/r/cosmosdb_cassandra_table.html.markdown @@ -36,10 +36,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_cassandra_keyspace" "example" { diff --git a/website/docs/r/cosmosdb_mongo_role_definition.html.markdown b/website/docs/r/cosmosdb_mongo_role_definition.html.markdown index f71356847583..35b27cfa9531 100644 --- a/website/docs/r/cosmosdb_mongo_role_definition.html.markdown +++ b/website/docs/r/cosmosdb_mongo_role_definition.html.markdown @@ -41,10 +41,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "example" { diff --git a/website/docs/r/cosmosdb_mongo_user_definition.html.markdown b/website/docs/r/cosmosdb_mongo_user_definition.html.markdown index abe8132ce8de..94aed01029f0 100644 --- a/website/docs/r/cosmosdb_mongo_user_definition.html.markdown +++ b/website/docs/r/cosmosdb_mongo_user_definition.html.markdown @@ -41,10 +41,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_mongo_database" "example" { diff --git a/website/docs/r/cosmosdb_notebook_workspace.html.markdown b/website/docs/r/cosmosdb_notebook_workspace.html.markdown index 679923f6e921..70fd8adffbda 100644 --- a/website/docs/r/cosmosdb_notebook_workspace.html.markdown +++ b/website/docs/r/cosmosdb_notebook_workspace.html.markdown @@ -39,10 +39,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_notebook_workspace" "example" { diff --git a/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown b/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown index ddb0362ded3b..716b01b87220 100644 --- a/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown +++ b/website/docs/r/cosmosdb_sql_dedicated_gateway.html.markdown @@ -33,10 +33,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_dedicated_gateway" "example" { diff --git a/website/docs/r/cosmosdb_sql_role_assignment.html.markdown b/website/docs/r/cosmosdb_sql_role_assignment.html.markdown index f9c28e6aa9c0..83792582f971 100644 --- a/website/docs/r/cosmosdb_sql_role_assignment.html.markdown +++ b/website/docs/r/cosmosdb_sql_role_assignment.html.markdown @@ -35,10 +35,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_role_definition" "example" { diff --git a/website/docs/r/cosmosdb_sql_role_definition.html.markdown b/website/docs/r/cosmosdb_sql_role_definition.html.markdown index ef92512a0417..3ecd6e61669c 100644 --- a/website/docs/r/cosmosdb_sql_role_definition.html.markdown +++ b/website/docs/r/cosmosdb_sql_role_definition.html.markdown @@ -35,10 +35,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_role_definition" "example" { diff --git a/website/docs/r/function_app_connection.html.markdown b/website/docs/r/function_app_connection.html.markdown index 48821e873bb2..b69f434874b7 100644 --- a/website/docs/r/function_app_connection.html.markdown +++ b/website/docs/r/function_app_connection.html.markdown @@ -35,10 +35,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown b/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown index 4e656ea36b0c..1a89224d2636 100644 --- a/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown +++ b/website/docs/r/iothub_endpoint_cosmosdb_account.html.markdown @@ -50,10 +50,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/kusto_cosmosdb_data_connection.html.markdown b/website/docs/r/kusto_cosmosdb_data_connection.html.markdown index 7693dcecf494..5f7bff78438a 100644 --- a/website/docs/r/kusto_cosmosdb_data_connection.html.markdown +++ b/website/docs/r/kusto_cosmosdb_data_connection.html.markdown @@ -47,10 +47,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown b/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown index 79edfa3e2aee..8e5f486b432d 100644 --- a/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown +++ b/website/docs/r/spring_cloud_app_cosmosdb_association.html.markdown @@ -45,10 +45,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_spring_cloud_app_cosmosdb_association" "example" { diff --git a/website/docs/r/spring_cloud_connection.html.markdown b/website/docs/r/spring_cloud_connection.html.markdown index eb31d011b8f1..d683578d72eb 100644 --- a/website/docs/r/spring_cloud_connection.html.markdown +++ b/website/docs/r/spring_cloud_connection.html.markdown @@ -35,10 +35,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { diff --git a/website/docs/r/stream_analytics_output_cosmosdb.html.markdown b/website/docs/r/stream_analytics_output_cosmosdb.html.markdown index 80aae19b01cd..5033b7807101 100644 --- a/website/docs/r/stream_analytics_output_cosmosdb.html.markdown +++ b/website/docs/r/stream_analytics_output_cosmosdb.html.markdown @@ -40,10 +40,6 @@ resource "azurerm_cosmosdb_account" "example" { location = azurerm_resource_group.example.location failover_priority = 0 } - - lifecycle { - ignore_changes = [minimal_tls_version] - } } resource "azurerm_cosmosdb_sql_database" "example" { From 47771f74480a0789ba8df43991f9bec3d59c4447 Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Tue, 30 Jan 2024 10:50:24 +0800 Subject: [PATCH 09/10] update code --- .../cosmos/cosmosdb_account_resource.go | 18 +-------- .../cosmos/cosmosdb_account_resource_test.go | 37 +++++-------------- website/docs/r/cosmosdb_account.html.markdown | 2 - 3 files changed, 11 insertions(+), 46 deletions(-) diff --git a/internal/services/cosmos/cosmosdb_account_resource.go b/internal/services/cosmos/cosmosdb_account_resource.go index 1d86feb40d42..124fe48ee2d9 100644 --- a/internal/services/cosmos/cosmosdb_account_resource.go +++ b/internal/services/cosmos/cosmosdb_account_resource.go @@ -479,13 +479,6 @@ func resourceCosmosDbAccount() *pluginsdk.Resource { Default: false, }, - // The `minimalTlsVersion` of the source CosmosDB Account is `Tls12` when it isn't set in the request payload but the `minimalTlsVersion` of the restored CosmosDB Account is `Tls` when it isn't set in the request payload. So the default value isn't added in the schema. - "minimal_tls_version": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringInSlice(cosmosdb.PossibleValuesForMinimalTlsVersion(), false), - }, - "mongo_server_version": { Type: pluginsdk.TypeString, Optional: true, @@ -827,10 +820,6 @@ func resourceCosmosDbAccountCreate(d *pluginsdk.ResourceData, meta interface{}) Tags: tags.Expand(t), } - if v, ok := d.GetOk("minimal_tls_version"); ok { - account.Properties.MinimalTlsVersion = pointer.To(cosmosdb.MinimalTlsVersion(v.(string))) - } - // These values may not have changed but they need to be in the update params... if v, ok := d.GetOk("default_identity_type"); ok { account.Properties.DefaultIdentity = pointer.To(v.(string)) @@ -1016,7 +1005,7 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) "capacity", "create_mode", "restore", "key_vault_key_id", "mongo_server_version", "public_network_access_enabled", "ip_range_filter", "offer_type", "is_virtual_network_filter_enabled", "kind", "tags", "enable_free_tier", "enable_automatic_failover", "analytical_storage_enabled", - "local_authentication_disabled", "partition_merge_enabled", "minimal_tls_version") { + "local_authentication_disabled", "partition_merge_enabled") { updateRequired = true } @@ -1068,10 +1057,6 @@ func resourceCosmosDbAccountUpdate(d *pluginsdk.ResourceData, meta interface{}) Tags: t, } - if v, ok := d.GetOk("minimal_tls_version"); ok { - account.Properties.MinimalTlsVersion = pointer.To(cosmosdb.MinimalTlsVersion(v.(string))) - } - if keyVaultKeyIDRaw, ok := d.GetOk("key_vault_key_id"); ok { keyVaultKey, err := keyVaultParse.ParseOptionallyVersionedNestedItemID(keyVaultKeyIDRaw.(string)) if err != nil { @@ -1352,7 +1337,6 @@ func resourceCosmosDbAccountRead(d *pluginsdk.ResourceData, meta interface{}) er d.Set("default_identity_type", props.DefaultIdentity) d.Set("create_mode", pointer.From(props.CreateMode)) d.Set("partition_merge_enabled", pointer.From(props.EnablePartitionMerge)) - d.Set("minimal_tls_version", pointer.From(props.MinimalTlsVersion)) if v := existing.Model.Properties.IsVirtualNetworkFilterEnabled; v != nil { d.Set("is_virtual_network_filter_enabled", props.IsVirtualNetworkFilterEnabled) diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index f0a221a93811..f550d793c187 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -420,7 +420,7 @@ func testAccCosmosDBAccount_updateConsistency(t *testing.T, kind cosmosdb.Databa }, data.ImportStep(), { - Config: r.consistency(data, kind, false, cosmosdb.MinimalTlsVersionTlsOneOne, cosmosdb.DefaultConsistencyLevelStrong, 8, 880), + Config: r.consistency(data, kind, false, cosmosdb.DefaultConsistencyLevelStrong, 8, 880), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelStrong, 1), }, data.ImportStep(), @@ -430,12 +430,12 @@ func testAccCosmosDBAccount_updateConsistency(t *testing.T, kind cosmosdb.Databa }, data.ImportStep(), { - Config: r.consistency(data, kind, true, cosmosdb.MinimalTlsVersionTlsOneOne, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), + Config: r.consistency(data, kind, true, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 7, 770), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 1), }, data.ImportStep(), { - Config: r.consistency(data, kind, false, cosmosdb.MinimalTlsVersionTlsOneTwo, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 77, 700), + Config: r.consistency(data, kind, false, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 77, 700), Check: checkAccCosmosDBAccount_basic(data, cosmosdb.DefaultConsistencyLevelBoundedStaleness, 1), }, data.ImportStep(), @@ -1441,7 +1441,7 @@ resource "azurerm_cosmosdb_account" "import" { `, r.basic(data, "GlobalDocumentDB", consistency)) } -func (CosmosDBAccountResource) consistency(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, partitionMergeEnabled bool, minimalTlsVersion cosmosdb.MinimalTlsVersion, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { +func (CosmosDBAccountResource) consistency(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, partitionMergeEnabled bool, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { return fmt.Sprintf(` provider "azurerm" { features {} @@ -1459,7 +1459,6 @@ resource "azurerm_cosmosdb_account" "test" { offer_type = "Standard" kind = "%s" partition_merge_enabled = %t - minimal_tls_version = "%s" consistency_policy { consistency_level = "%s" @@ -1472,7 +1471,7 @@ resource "azurerm_cosmosdb_account" "test" { failover_priority = 0 } } -`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), partitionMergeEnabled, string(minimalTlsVersion), string(consistency), interval, staleness) +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(kind), partitionMergeEnabled, string(consistency), interval, staleness) } func (CosmosDBAccountResource) consistencyMongoDB(data acceptance.TestData, consistency cosmosdb.DefaultConsistencyLevel, interval, staleness int) string { @@ -3577,8 +3576,7 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities, - minimal_tls_version + capabilities ] } } @@ -3654,8 +3652,7 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities, - minimal_tls_version + capabilities ] } } @@ -3720,8 +3717,7 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities, - minimal_tls_version + capabilities ] } } @@ -3762,8 +3758,7 @@ resource "azurerm_cosmosdb_account" "test" { lifecycle { ignore_changes = [ - capabilities, - minimal_tls_version + capabilities ] } } @@ -4113,8 +4108,7 @@ resource "azurerm_cosmosdb_account" "test" { // As "restore_timestamp_in_utc" is retrieved dynamically, so it would cause diff when tf plan. So we have to ignore it here. lifecycle { ignore_changes = [ - restore.0.restore_timestamp_in_utc, - minimal_tls_version + restore.0.restore_timestamp_in_utc ] } } @@ -4338,54 +4332,43 @@ resource "azurerm_cosmosdb_account" "test" { func (r CosmosDBAccountResource) withoutMaxAgeInSeconds(data acceptance.TestData, kind cosmosdb.DatabaseAccountKind, consistency cosmosdb.DefaultConsistencyLevel) string { return fmt.Sprintf(` %[1]s - resource "azurerm_cosmosdb_account" "test" { name = "acctest-ca-%[2]d" location = azurerm_resource_group.test.location resource_group_name = azurerm_resource_group.test.name offer_type = "Standard" kind = "%[3]s" - consistency_policy { consistency_level = "%[4]s" max_interval_in_seconds = 300 max_staleness_prefix = 170000 } - is_virtual_network_filter_enabled = true - virtual_network_rule { id = azurerm_subnet.subnet1.id } - virtual_network_rule { id = azurerm_subnet.subnet2.id } - enable_multiple_write_locations = true - geo_location { location = azurerm_resource_group.test.location failover_priority = 0 } - geo_location { location = "%[5]s" failover_priority = 1 } - geo_location { location = "%[6]s" failover_priority = 2 } - cors_rule { allowed_origins = ["http://www.example.com"] exposed_headers = ["x-tempo-*"] allowed_headers = ["x-tempo-*"] allowed_methods = ["GET", "PUT"] } - access_key_metadata_writes_enabled = false network_acl_bypass_for_azure_services = true } diff --git a/website/docs/r/cosmosdb_account.html.markdown b/website/docs/r/cosmosdb_account.html.markdown index 17177cd3b52a..d14da042af98 100644 --- a/website/docs/r/cosmosdb_account.html.markdown +++ b/website/docs/r/cosmosdb_account.html.markdown @@ -166,8 +166,6 @@ The following arguments are supported: * `access_key_metadata_writes_enabled` - (Optional) Is write operations on metadata resources (databases, containers, throughput) via account keys enabled? Defaults to `true`. -* `minimal_tls_version` - (Optional) The minimum allowed TLS version. Possible values are `Tls`, `Tls11`, and `Tls12`. - * `mongo_server_version` - (Optional) The Server Version of a MongoDB account. Possible values are `4.2`, `4.0`, `3.6`, and `3.2`. * `network_acl_bypass_for_azure_services` - (Optional) If Azure services can bypass ACLs. Defaults to `false`. From 647ff59723c4d99530757d9e10f9b17e9db7ebce Mon Sep 17 00:00:00 2001 From: neil-yechenwei Date: Tue, 30 Jan 2024 10:53:04 +0800 Subject: [PATCH 10/10] update code --- internal/services/cosmos/cosmosdb_account_resource_test.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/services/cosmos/cosmosdb_account_resource_test.go b/internal/services/cosmos/cosmosdb_account_resource_test.go index f550d793c187..a7ed7274c03a 100644 --- a/internal/services/cosmos/cosmosdb_account_resource_test.go +++ b/internal/services/cosmos/cosmosdb_account_resource_test.go @@ -3542,6 +3542,7 @@ resource "azurerm_cosmosdb_account" "test" { location = azurerm_resource_group.test.location failover_priority = 0 } + } `, r.basicWithNetworkBypassTemplate(data), data.RandomInteger, string(kind), string(consistency)) } @@ -3655,6 +3656,7 @@ resource "azurerm_cosmosdb_account" "test" { capabilities ] } + } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger, string(consistency)) }