Skip to content

Commit

Permalink
azurerm_iot_security_solution - update test cases (#28026)
Browse files Browse the repository at this point in the history
* `azurerm_iot_security_solution` - update test cases

* update role assignemtn
  • Loading branch information
ziyeqf authored Nov 15, 2024
1 parent 873c388 commit 020ae9a
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ resource "azurerm_iot_security_solution" "test" {
location = azurerm_resource_group.test.location
display_name = "Iot Security Solution"
iothub_ids = [azurerm_iothub.test.id]
depends_on = [azurerm_role_assignment.iot-assign]
}
`, r.template(data), data.RandomInteger)
}
Expand All @@ -152,6 +154,8 @@ resource "azurerm_iot_security_solution" "import" {
location = azurerm_iot_security_solution.test.location
display_name = azurerm_iot_security_solution.test.display_name
iothub_ids = [azurerm_iothub.test.id]
depends_on = [azurerm_role_assignment.iot-assign]
}
`, r.basic(data))
}
Expand Down Expand Up @@ -235,6 +239,8 @@ resource "azurerm_iot_security_solution" "test" {
tags = {
"Env" : "Staging"
}
depends_on = [azurerm_role_assignment.iot-assign, azurerm_role_assignment.law-assign]
}
`, r.template(data), data.RandomInteger, data.RandomInteger)
}
Expand All @@ -261,6 +267,8 @@ resource "azurerm_iot_security_solution" "test" {
data_types = ["Alerts"]
workspace_id = azurerm_log_analytics_workspace.test.id
}
depends_on = [azurerm_role_assignment.iot-assign]
}
`, r.template(data), data.RandomInteger, data.RandomInteger)
}
Expand Down Expand Up @@ -294,6 +302,8 @@ resource "azurerm_iot_security_solution" "test" {
data_types = ["Alerts", "RawEvents"]
workspace_id = azurerm_log_analytics_workspace.test2.id
}
depends_on = [azurerm_role_assignment.iot-assign, azurerm_role_assignment.law-assign]
}
`, r.template(data), data.RandomInteger, data.RandomInteger, data.RandomInteger)
}
Expand All @@ -319,5 +329,21 @@ resource "azurerm_iothub" "test" {
capacity = "1"
}
}
data "azuread_service_principal" "iotsec" {
display_name = "Azure Security for IoT"
}
resource "azurerm_role_assignment" "iot-assign" {
scope = azurerm_resource_group.test.id
role_definition_name = "Contributor"
principal_id = data.azuread_service_principal.iotsec.object_id
}
resource "azurerm_role_assignment" "law-assign" {
scope = azurerm_iothub.test.id
role_definition_name = "Log Analytics Contributor"
principal_id = data.azuread_service_principal.iotsec.object_id
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}

0 comments on commit 020ae9a

Please sign in to comment.