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_log_analytics_solution - add support of tags #9048

Merged
merged 2 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -6,6 +6,8 @@ import (
"strings"
"time"

"github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/tags"

"github.com/Azure/azure-sdk-for-go/services/preview/operationsmanagement/mgmt/2015-11-01-preview/operationsmanagement"
"github.com/hashicorp/go-azure-helpers/response"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
Expand Down Expand Up @@ -89,6 +91,8 @@ func resourceArmLogAnalyticsSolution() *schema.Resource {
},
},
},

"tags": tags.Schema(),
},
}
}
Expand Down Expand Up @@ -130,6 +134,7 @@ func resourceArmLogAnalyticsSolutionCreateUpdate(d *schema.ResourceData, meta in
Properties: &operationsmanagement.SolutionProperties{
WorkspaceResourceID: utils.String(workspaceID),
},
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
}

future, err := client.CreateOrUpdate(ctx, resGroup, name, parameters)
Expand Down Expand Up @@ -207,7 +212,7 @@ func resourceArmLogAnalyticsSolutionRead(d *schema.ResourceData, meta interface{
return fmt.Errorf("Error setting `plan`: %+v", err)
}

return nil
return tags.FlattenAndSet(d, resp.Tags)
}

func resourceArmLogAnalyticsSolutionDelete(d *schema.ResourceData, meta interface{}) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ resource "azurerm_log_analytics_solution" "test" {
publisher = "Microsoft"
product = "OMSGallery/ContainerInsights"
}

tags = {
environment = "Test"
katbyte marked this conversation as resolved.
Show resolved Hide resolved
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/log_analytics_solution.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ The following arguments are supported:

* `plan` - (Required) A `plan` block as documented below.

* `tags` - (Optional) A mapping of tags to assign to the resource.

---

A `plan` block includes:
Expand Down