@@ -9,11 +9,11 @@ import (
99 "fmt"
1010 "time"
1111
12+ "github.com/hashicorp/go-azure-helpers/lang/pointer"
1213 "github.com/hashicorp/go-azure-helpers/lang/response"
1314 "github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
1415 "github.com/hashicorp/go-azure-helpers/resourcemanager/tags"
1516 "github.com/hashicorp/go-azure-sdk/resource-manager/automation/2023-11-01/module"
16- "github.com/hashicorp/terraform-provider-azurerm/helpers/tf"
1717 "github.com/hashicorp/terraform-provider-azurerm/internal/sdk"
1818 "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
1919 "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation"
@@ -129,14 +129,11 @@ func (r PowerShell72ModuleResource) Create() sdk.ResourceFunc {
129129 if err != nil && ! response .WasNotFound (existing .HttpResponse ) {
130130 return fmt .Errorf ("checking for presence of existing %s: %+v" , id , err )
131131 }
132- if ! response .WasNotFound (existing .HttpResponse ) {
133- return metadata .ResourceRequiresImport (r .ResourceType (), id )
134- }
135132
136133 // for existing global module do update instead of raising ImportAsExistsError
137- isGlobal := existing .Model != nil && existing .Model .Properties != nil && existing . Model . Properties . IsGlobal != nil && * existing .Model .Properties .IsGlobal
134+ isGlobal := existing .Model != nil && existing .Model .Properties != nil && pointer . From ( existing .Model .Properties .IsGlobal )
138135 if ! response .WasNotFound (existing .HttpResponse ) && ! isGlobal {
139- return tf . ImportAsExistsError ( "azurerm_automation_powershell72_module" , id . ID () )
136+ return metadata . ResourceRequiresImport ( r . ResourceType (), id )
140137 }
141138
142139 parameters := module.ModuleCreateOrUpdateParameters {
0 commit comments