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

Use lower casing for OMS agent and correct solution for container monitoring #1995

Merged
merged 6 commits into from
Oct 2, 2018
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
4 changes: 2 additions & 2 deletions azurerm/resource_arm_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ func expandAzureRmKubernetesClusterAddonProfiles(d *schema.ResourceData) map[str
config["logAnalyticsWorkspaceResourceID"] = utils.String(workspaceId.(string))
}

addonProfiles["omsAgent"] = &containerservice.ManagedClusterAddonProfile{
addonProfiles["omsagent"] = &containerservice.ManagedClusterAddonProfile{
Enabled: utils.Bool(enabled),
Config: config,
}
Expand Down Expand Up @@ -884,7 +884,7 @@ func flattenAzureRmKubernetesClusterAddonProfiles(profile map[string]*containers
values["http_application_routing"] = routes

agents := make([]interface{}, 0)
if omsAgent := profile["omsAgent"]; omsAgent != nil {
if omsAgent := profile["omsagent"]; omsAgent != nil {
enabled := false
if enabledVal := omsAgent.Enabled; enabledVal != nil {
enabled = *enabledVal
Expand Down
13 changes: 13 additions & 0 deletions azurerm/resource_arm_kubernetes_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,19 @@ resource "azurerm_log_analytics_workspace" "test" {
sku = "PerGB2018"
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
workspace_name = "${azurerm_log_analytics_workspace.test.name}"

plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
}

resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks%d"
location = "${azurerm_resource_group.test.location}"
Expand Down
4 changes: 2 additions & 2 deletions azurerm/resource_arm_log_analytics_solution_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ resource "azurerm_log_analytics_workspace" "test" {
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "Containers"
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
workspace_name = "${azurerm_log_analytics_workspace.test.name}"

plan {
publisher = "Microsoft"
product = "OMSGallery/Containers"
product = "OMSGallery/ContainerInsights"
}
}
`, rInt, location, rInt)
Expand Down
2 changes: 1 addition & 1 deletion examples/log-analytics-container-monitoring/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resource "azurerm_log_analytics_workspace" "test" {
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "Containers"
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
Expand Down
49 changes: 48 additions & 1 deletion website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ resource "azurerm_resource_group" "test" {
location = "East US"
}

resource "azurerm_log_analytics_workspace" "test" {
name = "acctestLAW1"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
sku = "PerGB2018"
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
workspace_name = "${azurerm_log_analytics_workspace.test.name}"

plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
}

resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks1"
location = "${azurerm_resource_group.test.location}"
Expand All @@ -39,6 +59,13 @@ resource "azurerm_kubernetes_cluster" "test" {
client_id = "00000000-0000-0000-0000-000000000000"
client_secret = "00000000000000000000000000000000"
}

addon_profile {
oms_agent {
enabled = true
log_analytics_workspace_id = "${azurerm_log_analytics_workspace.test.id}"
}
}

tags {
Environment = "Production"
Expand Down Expand Up @@ -99,6 +126,19 @@ resource "azurerm_subnet" "test_subnet" {
virtual_network_name = "${azurerm_virtual_network.test_advanced_network.name}"
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
workspace_name = "${azurerm_log_analytics_workspace.test.name}"

plan {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}
}

resource "azurerm_kubernetes_cluster" "test" {
name = "akc-1"
location = "${azurerm_resource_group.test.location}"
Expand Down Expand Up @@ -128,6 +168,13 @@ resource "azurerm_kubernetes_cluster" "test" {
client_id = "00000000-0000-0000-0000-000000000000"
client_secret = "00000000000000000000000000000000"
}

addon_profile {
oms_agent {
enabled = true
log_analytics_workspace_id = "${azurerm_log_analytics_workspace.test.id}"
}
}

network_profile {
network_plugin = "azure"
Expand Down Expand Up @@ -194,7 +241,7 @@ The following arguments are supported:
A `addon_profile` block supports the following:

* `http_application_routing` - (Optional) A `http_application_routing` block.
* `oms_agent` - (Optional) A `oms_agent` block.
* `oms_agent` - (Optional) A `oms_agent` block. For more details, please visit [How to onboard Azure Monitor for containers](https://docs.microsoft.com/en-us/azure/monitoring/monitoring-container-insights-onboard).

---

Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/log_analytics_solution.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ resource "azurerm_log_analytics_workspace" "test" {
}

resource "azurerm_log_analytics_solution" "test" {
solution_name = "Containers"
solution_name = "ContainerInsights"
location = "${azurerm_resource_group.test.location}"
resource_group_name = "${azurerm_resource_group.test.name}"
workspace_resource_id = "${azurerm_log_analytics_workspace.test.id}"
workspace_name = "${azurerm_log_analytics_workspace.test.name}"

plan {
publisher = "Microsoft"
product = "OMSGallery/Containers"
product = "OMSGallery/ContainerInsights"
}
}
```
Expand Down