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_iot_security_solution - update test cases #28026

Merged
merged 2 commits into from
Nov 15, 2024
Merged
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
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)
}
Loading