Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_cosmosdb_account - add state migration for ip_range_filter underlying type change #27276

Merged
merged 6 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions internal/services/cosmos/common/ip_rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/utils"
)

// CosmosDBIpRulesToIpRangeFilterThreePointOh todo Remove for 4.0
func CosmosDBIpRulesToIpRangeFilterThreePointOh(ipRules *[]cosmosdb.IPAddressOrRange) string {
// CosmosDBIpRulesToIpRangeFilterDataSource todo Remove for 4.0
func CosmosDBIpRulesToIpRangeFilterDataSource(ipRules *[]cosmosdb.IPAddressOrRange) string {
ipRangeFilter := make([]string, 0)
if ipRules != nil {
for _, ipRule := range *ipRules {
Expand Down
42 changes: 1 addition & 41 deletions internal/services/cosmos/cosmosdb_account_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/cosmosdb/2024-05-15/cosmosdb"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/cosmos/common"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
Expand Down Expand Up @@ -249,35 +248,6 @@ func dataSourceCosmosDbAccount() *pluginsdk.Resource {
},
}

if !features.FourPointOhBeta() {
dataSource.Schema["connection_strings"] = &pluginsdk.Schema{
Type: pluginsdk.TypeList,
Computed: true,
Sensitive: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Sensitive: true,
},
Deprecated: "This property has been superseded by the primary and secondary connection strings for sql, mongodb and readonly and will be removed in v4.0 of the AzureRM provider",
}
dataSource.Schema["enable_free_tier"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Computed: true,
Deprecated: "This property has been renamed to `free_tier_enabled` and will be removed in v4.0 of the AzureRM provider",
}
dataSource.Schema["enable_automatic_failover"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Computed: true,
Deprecated: "This property has been renamed to `automatic_failover_enabled` and will be removed in v4.0 of the AzureRM provider",
}
dataSource.Schema["enable_multiple_write_locations"] = &pluginsdk.Schema{
Type: pluginsdk.TypeBool,
Computed: true,
Deprecated: "This property has been renamed to `multiple_write_locations_enabled` and will be removed in v4.0 of the AzureRM provider",
}

}

return dataSource
}

Expand Down Expand Up @@ -309,15 +279,9 @@ func dataSourceCosmosDbAccountRead(d *pluginsdk.ResourceData, meta interface{})

if props := model.Properties; props != nil {
d.Set("offer_type", string(pointer.From(props.DatabaseAccountOfferType)))
d.Set("ip_range_filter", common.CosmosDBIpRulesToIpRangeFilterThreePointOh(props.IPRules))
d.Set("ip_range_filter", common.CosmosDBIpRulesToIpRangeFilterDataSource(props.IPRules))
d.Set("endpoint", props.DocumentEndpoint)
d.Set("is_virtual_network_filter_enabled", props.IsVirtualNetworkFilterEnabled)
if !features.FourPointOhBeta() {
d.Set("enable_free_tier", props.EnableFreeTier)
d.Set("enable_automatic_failover", props.EnableAutomaticFailover)
d.Set("enable_multiple_write_locations", props.EnableMultipleWriteLocations)
}

d.Set("free_tier_enabled", props.EnableFreeTier)
d.Set("automatic_failover_enabled", props.EnableAutomaticFailover)
d.Set("multiple_write_locations_enabled", props.EnableMultipleWriteLocations)
Expand Down Expand Up @@ -440,10 +404,6 @@ func dataSourceCosmosDbAccountRead(d *pluginsdk.ResourceData, meta interface{})
}
}
}

if !features.FourPointOhBeta() {
d.Set("connection_strings", connStrings)
}
}
}
return nil
Expand Down
Loading
Loading