Skip to content

Commit

Permalink
Merge branch 'hashicorp:main' into 25803
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceharrison1984 authored Jul 31, 2024
2 parents f544df8 + 8b36abf commit e6a4847
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
21 changes: 11 additions & 10 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,21 @@ If you wish to work on the provider, you'll first need [Go](https://go.dev/) ins
First clone the repository to: `$GOPATH/src/github.com/hashicorp/terraform-provider-azurerm`

```sh
$ mkdir -p $GOPATH/src/github.com/hashicorp; cd $GOPATH/src/github.com/hashicorp
$ git clone [email protected]:hashicorp/terraform-provider-azurerm
$ cd $GOPATH/src/github.com/hashicorp/terraform-provider-azurerm
mkdir -p $GOPATH/src/github.com/hashicorp; cd $GOPATH/src/github.com/hashicorp
git clone [email protected]:hashicorp/terraform-provider-azurerm
cd $GOPATH/src/github.com/hashicorp/terraform-provider-azurerm
```

Once inside the provider directory, you can run `make tools` to install the dependent tooling required to compile the provider.

At this point you can compile the provider by running `make build`, which will build the provider and put the provider binary in the `$GOPATH/bin` directory.

```sh
$ make build
...
$ $GOPATH/bin/terraform-provider-azurerm
...
make build
# ... make output omitted ...
# The provider binary will be output to:
# $GOPATH/bin/terraform-provider-azurerm
# ...
```

You can also cross-compile if necessary:
Expand All @@ -63,7 +64,7 @@ GOOS=windows GOARCH=amd64 make build
In order to run the `Unit Tests` for the provider, you can run:

```sh
$ make test
make test
```

The majority of tests in the provider are `Acceptance Tests` - which provisions real resources in Azure. It's possible to run the entire acceptance test suite by running `make testacc` - however it's likely you'll want to run a subset, which you can do using a prefix, by running:
Expand Down Expand Up @@ -140,11 +141,11 @@ When `make generate` is run, this will then generate the following for this Reso
You can scaffold the documentation for a Data Source by running:

```sh
$ make scaffold-website BRAND_NAME="Resource Group" RESOURCE_NAME="azurerm_resource_group" RESOURCE_TYPE="data"
make scaffold-website BRAND_NAME="Resource Group" RESOURCE_NAME="azurerm_resource_group" RESOURCE_TYPE="data"
```

You can scaffold the documentation for a Resource by running:

```sh
$ make scaffold-website BRAND_NAME="Resource Group" RESOURCE_NAME="azurerm_resource_group" RESOURCE_TYPE="resource" RESOURCE_ID="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1"
make scaffold-website BRAND_NAME="Resource Group" RESOURCE_NAME="azurerm_resource_group" RESOURCE_TYPE="resource" RESOURCE_ID="/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1"
```
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),
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

0 comments on commit e6a4847

Please sign in to comment.