Skip to content

Commit

Permalink
set flags within block that nil checks model and return nil at the en…
Browse files Browse the repository at this point in the history
…d of the successful read
  • Loading branch information
stephybun committed Aug 21, 2024
1 parent df510a5 commit e0962f8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions internal/services/mssql/mssql_job_agent_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/hashicorp/go-azure-helpers/lang/response"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonids"
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/go-azure-helpers/resourcemanager/location"
"github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
"github.com/hashicorp/go-azure-sdk/resource-manager/sql/2023-08-01-preview/jobagents"
"github.com/hashicorp/terraform-provider-azurerm/helpers/azure"
Expand Down Expand Up @@ -132,14 +133,14 @@ func resourceMsSqlJobAgentRead(d *pluginsdk.ResourceData, meta interface{}) erro
d.Set("name", id.JobAgentName)

if model := resp.Model; model != nil {
d.Set("location", azure.NormalizeLocation(model.Location))
d.Set("location", location.Normalize(model.Location))

if props := resp.Model.Properties; props != nil {
d.Set("database_id", props.DatabaseId)
}
return tags.FlattenAndSet(d, model.Tags)
}

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

func resourceMsSqlJobAgentDelete(d *pluginsdk.ResourceData, meta interface{}) error {
Expand Down

0 comments on commit e0962f8

Please sign in to comment.