Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei committed Jun 28, 2022
1 parent 649c946 commit f5c7cbd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func resourceLogAnalyticsWorkspace() *pluginsdk.Resource {

"resource_group_name": azure.SchemaResourceGroupNameDiffSuppress(),

"force_cmk_for_query": {
"cmk_for_query_forced": {
Type: pluginsdk.TypeBool,
Optional: true,
},
Expand Down Expand Up @@ -239,7 +239,7 @@ func resourceLogAnalyticsWorkspaceCreateUpdate(d *pluginsdk.ResourceData, meta i
},
}

if v, ok := d.GetOkExists("force_cmk_for_query"); ok {
if v, ok := d.GetOkExists("cmk_for_query_forced"); ok {
parameters.Properties.ForceCmkForQuery = utils.Bool(v.(bool))
}

Expand Down Expand Up @@ -318,7 +318,7 @@ func resourceLogAnalyticsWorkspaceRead(d *pluginsdk.ResourceData, meta interface
}
d.Set("sku", skuName)

d.Set("force_cmk_for_query", props.ForceCmkForQuery)
d.Set("cmk_for_query_forced", props.ForceCmkForQuery)
d.Set("retention_in_days", props.RetentionInDays)

if props.Sku != nil && strings.EqualFold(string(props.Sku.Name), string(workspaces.WorkspaceSkuNameEnumFree)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@ func TestAccLogAnalyticsWorkspace_negativeOne(t *testing.T) {
})
}

func TestAccLogAnalyticsWorkspace_forceCmkForQuery(t *testing.T) {
func TestAccLogAnalyticsWorkspace_cmkForQueryForced(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_log_analytics_workspace", "test")
r := LogAnalyticsWorkspaceResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.forceCmkForQuery(data, true),
Config: r.cmkForQueryForced(data, true),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.forceCmkForQuery(data, false),
Config: r.cmkForQueryForced(data, false),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
Expand Down Expand Up @@ -573,7 +573,7 @@ resource "azurerm_log_analytics_workspace" "test" {
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, capacityReservation)
}

func (LogAnalyticsWorkspaceResource) forceCmkForQuery(data acceptance.TestData, forceCmkForQuery bool) string {
func (LogAnalyticsWorkspaceResource) cmkForQueryForced(data acceptance.TestData, cmkForQueryForced bool) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -585,12 +585,12 @@ resource "azurerm_resource_group" "test" {
}
resource "azurerm_log_analytics_workspace" "test" {
name = "acctestLAW-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku = "PerGB2018"
retention_in_days = 30
force_cmk_for_query = %t
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, forceCmkForQuery)
name = "acctestLAW-%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku = "PerGB2018"
retention_in_days = 30
cmk_for_query_forced = %t
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, cmkForQueryForced)
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func workspaceSchemaForV0AndV1() map[string]*pluginsdk.Schema {
ForceNew: true,
},

"force_cmk_for_query": {
"cmk_for_query_forced": {
Type: pluginsdk.TypeBool,
Optional: true,
},
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/log_analytics_workspace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The following arguments are supported:

~> **NOTE:** When `sku` is set to `Free` this field should not be set and has a default value of `0.5`.

* `force_cmk_for_query` - (Optional) Is Customer Managed Storage mandatory for query management?
* `cmk_for_query_forced` - (Optional) Is Customer Managed Storage mandatory for query management?

* `internet_ingestion_enabled ` - (Optional) Should the Log Analytics Workspace support ingestion over the Public Internet? Defaults to `true`.

Expand Down

0 comments on commit f5c7cbd

Please sign in to comment.