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_log_analytics_workspace - remove "Free" option from sku #26477

Merged
Show file tree
Hide file tree
Changes from all 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
23 changes: 21 additions & 2 deletions internal/services/loganalytics/log_analytics_workspace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
"github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/features"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/migration"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/loganalytics/validate"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
Expand All @@ -31,7 +32,7 @@ import (
)

func resourceLogAnalyticsWorkspace() *pluginsdk.Resource {
return &pluginsdk.Resource{
resource := &pluginsdk.Resource{
Create: resourceLogAnalyticsWorkspaceCreateUpdate,
Read: resourceLogAnalyticsWorkspaceRead,
Update: resourceLogAnalyticsWorkspaceCreateUpdate,
Expand Down Expand Up @@ -107,7 +108,6 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource {
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
string(workspaces.WorkspaceSkuNameEnumFree),
Copy link
Contributor

Choose a reason for hiding this comment

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

Users who've previously provisioned a Resource using the Free SKU will be able to continue using it until they migrate to a different SKU - so removing this SKU would break support for those users?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @tombuildsstuff - It's removed in the next major release. Do you think we should keep it in the validation func in the next major release?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ms-henglu, how long has the free option no longer been valid? i think if it JUST changed maybe we want to keep the validation around in schema and maybe add a customize diff to prevent new ones from being created but if its been gone for a year then maybe it time to remove it?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @katbyte - The Free SKU was possible only until July 1, 2022. It's more than 2 years, I guess we could remove it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that has been a while, i think its fine to remove then

string(workspaces.WorkspaceSkuNameEnumPerGBTwoZeroOneEight),
string(workspaces.WorkspaceSkuNameEnumPerNode),
string(workspaces.WorkspaceSkuNameEnumPremium),
Expand Down Expand Up @@ -179,6 +179,25 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource {
"tags": commonschema.Tags(),
},
}

if !features.FourPointOhBeta() {
resource.Schema["sku"] = &pluginsdk.Schema{
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.StringInSlice([]string{
string(workspaces.WorkspaceSkuNameEnumFree),
string(workspaces.WorkspaceSkuNameEnumPerGBTwoZeroOneEight),
string(workspaces.WorkspaceSkuNameEnumPerNode),
string(workspaces.WorkspaceSkuNameEnumPremium),
string(workspaces.WorkspaceSkuNameEnumStandalone),
string(workspaces.WorkspaceSkuNameEnumStandard),
string(workspaces.WorkspaceSkuNameEnumCapacityReservation),
"Unlimited", // TODO check if this is actually no longer valid, removed in v28.0.0 of the SDK
}, false),
}
}
return resource
}

func resourceLogAnalyticsWorkspaceCustomDiff(ctx context.Context, d *pluginsdk.ResourceDiff, _ interface{}) error {
Expand Down
4 changes: 1 addition & 3 deletions website/docs/r/log_analytics_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ The following arguments are supported:

* `local_authentication_disabled` - (Optional) Specifies if the log Analytics workspace should enforce authentication using Azure AD. Defaults to `false`.

* `sku` - (Optional) Specifies the SKU of the Log Analytics Workspace. Possible values are `Free`, `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`.
* `sku` - (Optional) Specifies the SKU of the Log Analytics Workspace. Possible values are `PerNode`, `Premium`, `Standard`, `Standalone`, `Unlimited`, `CapacityReservation`, and `PerGB2018` (new SKU as of `2018-04-03`). Defaults to `PerGB2018`.

~> **NOTE:** A new pricing model took effect on `2018-04-03`, which requires the SKU `PerGB2018`. If you're provisioned resources before this date you have the option of remaining with the previous Pricing SKU and using the other SKUs defined above. More information about [the Pricing SKUs is available at the following URI](https://aka.ms/PricingTierWarning).

~> **NOTE:** Changing `sku` forces a new Log Analytics Workspace to be created, except when changing between `PerGB2018` and `CapacityReservation`. However, changing `sku` to `CapacityReservation` or changing `reservation_capacity_in_gb_per_day` to a higher tier will lead to a 31-days commitment period, during which the SKU cannot be changed to a lower one. Please refer to [official documentation](https://learn.microsoft.com/en-us/azure/azure-monitor/logs/cost-logs#commitment-tiers) for further information.

~> **NOTE:** The `Free` SKU has a default `daily_quota_gb` value of `0.5` (GB).

* `retention_in_days` - (Optional) The workspace data retention in days. Possible values are either 7 (Free Tier only) or range between 30 and 730.

* `daily_quota_gb` - (Optional) The workspace daily quota for ingestion in GB. Defaults to -1 (unlimited) if omitted.
Expand Down
Loading