diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 7ebe256e0a..79495d9f81 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -13,11 +13,11 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/auth" "github.com/hashicorp/go-azure-sdk/sdk/environments" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/sdk" + "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azuread/internal/tf/validation" ) // Microsoft’s Terraform Partner ID is this specific GUID @@ -31,10 +31,10 @@ type ServiceRegistration interface { WebsiteCategories() []string // SupportedDataSources returns the supported Data Sources supported by this Service - SupportedDataSources() map[string]*schema.Resource + SupportedDataSources() map[string]*pluginsdk.Resource // SupportedResources returns the supported Resources supported by this Service - SupportedResources() map[string]*schema.Resource + SupportedResources() map[string]*pluginsdk.Resource } // AzureADProvider returns a schema.Provider. @@ -52,8 +52,8 @@ func AzureADProvider() *schema.Provider { log.Printf(f, v...) } - dataSources := make(map[string]*schema.Resource) - resources := make(map[string]*schema.Resource) + dataSources := make(map[string]*pluginsdk.Resource) + resources := make(map[string]*pluginsdk.Resource) // first handle the typed services for _, service := range SupportedTypedServices() { @@ -111,37 +111,37 @@ func AzureADProvider() *schema.Provider { } p := &schema.Provider{ - Schema: map[string]*schema.Schema{ + Schema: map[string]*pluginsdk.Schema{ "client_id": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_ID", ""), Description: "The Client ID which should be used for service principal authentication", }, "client_id_file_path": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_ID_FILE_PATH", ""), Description: "The path to a file containing the Client ID which should be used for service principal authentication", }, "tenant_id": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_TENANT_ID", ""), Description: "The Tenant ID which should be used. Works with all authentication methods except Managed Identity", }, "environment": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc("ARM_ENVIRONMENT", "global"), Description: "The cloud environment which should be used. Possible values are: `global` (also `public`), `usgovernmentl4` (also `usgovernment`), `usgovernmentl5` (also `dod`), and `china`. Defaults to `global`", }, "metadata_host": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Required: true, DefaultFunc: schema.EnvDefaultFunc("ARM_METADATA_HOSTNAME", ""), Description: "The Hostname which should be used for the Azure Metadata Service.", @@ -149,21 +149,21 @@ func AzureADProvider() *schema.Provider { // Client Certificate specific fields "client_certificate": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_CERTIFICATE", ""), Description: "Base64 encoded PKCS#12 certificate bundle to use when authenticating as a Service Principal using a Client Certificate", }, "client_certificate_password": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_CERTIFICATE_PASSWORD", ""), Description: "The password to decrypt the Client Certificate. For use when authenticating as a Service Principal using a Client Certificate", }, "client_certificate_path": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_CERTIFICATE_PATH", ""), Description: "The path to the Client Certificate associated with the Service Principal for use when authenticating as a Service Principal using a Client Certificate", @@ -171,14 +171,14 @@ func AzureADProvider() *schema.Provider { // Client Secret specific fields "client_secret": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_SECRET", ""), Description: "The application password to use when authenticating as a Service Principal using a Client Secret", }, "client_secret_file_path": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_CLIENT_SECRET_FILE_PATH", ""), Description: "The path to a file containing the application password to use when authenticating as a Service Principal using a Client Secret", @@ -186,35 +186,35 @@ func AzureADProvider() *schema.Provider { // OIDC specific fields "use_oidc": { - Type: schema.TypeBool, + Type: pluginsdk.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_USE_OIDC", false), Description: "Allow OpenID Connect to be used for authentication", }, "oidc_token": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_OIDC_TOKEN", ""), Description: "The ID token for use when authenticating as a Service Principal using OpenID Connect.", }, "oidc_token_file_path": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_OIDC_TOKEN_FILE_PATH", ""), Description: "The path to a file containing an ID token for use when authenticating as a Service Principal using OpenID Connect.", }, "oidc_request_token": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{"ARM_OIDC_REQUEST_TOKEN", "ACTIONS_ID_TOKEN_REQUEST_TOKEN"}, ""), Description: "The bearer token for the request to the OIDC provider. For use when authenticating as a Service Principal using OpenID Connect.", }, "oidc_request_url": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.MultiEnvDefaultFunc([]string{"ARM_OIDC_REQUEST_URL", "ACTIONS_ID_TOKEN_REQUEST_URL"}, ""), Description: "The URL for the OIDC provider from which to request an ID token. For use when authenticating as a Service Principal using OpenID Connect.", @@ -222,7 +222,7 @@ func AzureADProvider() *schema.Provider { // CLI authentication specific fields "use_cli": { - Type: schema.TypeBool, + Type: pluginsdk.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_USE_CLI", true), Description: "Allow Azure CLI to be used for Authentication", @@ -230,14 +230,14 @@ func AzureADProvider() *schema.Provider { // Managed Identity specific fields "use_msi": { - Type: schema.TypeBool, + Type: pluginsdk.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_USE_MSI", false), Description: "Allow Managed Identity to be used for Authentication", }, "msi_endpoint": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_MSI_ENDPOINT", ""), Description: "The path to a custom endpoint for Managed Identity - in most circumstances this should be detected automatically", @@ -245,7 +245,7 @@ func AzureADProvider() *schema.Provider { // Managed Tracking GUID for User-agent "partner_id": { - Type: schema.TypeString, + Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validation.Any(validation.IsUUID, validation.StringIsEmpty), DefaultFunc: schema.EnvDefaultFunc("ARM_PARTNER_ID", ""), @@ -253,7 +253,7 @@ func AzureADProvider() *schema.Provider { }, "disable_terraform_partner_id": { - Type: schema.TypeBool, + Type: pluginsdk.TypeBool, Optional: true, DefaultFunc: schema.EnvDefaultFunc("ARM_DISABLE_TERRAFORM_PARTNER_ID", false), Description: "Disable the Terraform Partner ID, which is used if a custom `partner_id` isn't specified", @@ -270,24 +270,24 @@ func AzureADProvider() *schema.Provider { } func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc { - return func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + return func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { var certData []byte if encodedCert := d.Get("client_certificate").(string); encodedCert != "" { var err error certData, err = decodeCertificate(encodedCert) if err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } } clientSecret, err := getClientSecret(d) if err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } clientId, err := getClientId(d) if err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } var ( @@ -299,21 +299,21 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc { if metadataHost != "" { if env, err = environments.FromEndpoint(ctx, fmt.Sprintf("https://%s", metadataHost), envName); err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } } else if env, err = environments.FromName(envName); err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } if env.MicrosoftGraph == nil { - return nil, diag.Errorf("Microsoft Graph was not configured for the specified environment") + return nil, pluginsdk.DiagErrorf("Microsoft Graph was not configured for the specified environment") } else if endpoint, ok := env.MicrosoftGraph.Endpoint(); !ok || *endpoint == "" { - return nil, diag.Errorf("Microsoft Graph endpoint could not be determined for the specified environment") + return nil, pluginsdk.DiagErrorf("Microsoft Graph endpoint could not be determined for the specified environment") } idToken, err := oidcToken(d) if err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } authConfig := &auth.Credentials{ @@ -348,7 +348,7 @@ func providerConfigure(p *schema.Provider) schema.ConfigureContextFunc { } } -func buildClient(ctx context.Context, p *schema.Provider, authConfig *auth.Credentials, partnerId string) (*clients.Client, diag.Diagnostics) { +func buildClient(ctx context.Context, p *schema.Provider, authConfig *auth.Credentials, partnerId string) (*clients.Client, pluginsdk.Diagnostics) { clientBuilder := clients.ClientBuilder{ AuthConfig: authConfig, PartnerID: partnerId, @@ -362,7 +362,7 @@ func buildClient(ctx context.Context, p *schema.Provider, authConfig *auth.Crede client, err := clientBuilder.Build(stopCtx) if err != nil { - return nil, diag.FromErr(err) + return nil, pluginsdk.DiagFromErr(err) } return client, nil @@ -381,7 +381,7 @@ func decodeCertificate(clientCertificate string) ([]byte, error) { return pfx, nil } -func oidcToken(d *schema.ResourceData) (*string, error) { +func oidcToken(d *pluginsdk.ResourceData) (*string, error) { idToken := d.Get("oidc_token").(string) if path := d.Get("oidc_token_file_path").(string); path != "" { @@ -403,7 +403,7 @@ func oidcToken(d *schema.ResourceData) (*string, error) { return &idToken, nil } -func getClientId(d *schema.ResourceData) (*string, error) { +func getClientId(d *pluginsdk.ResourceData) (*string, error) { clientId := strings.TrimSpace(d.Get("client_id").(string)) if path := d.Get("client_id_file_path").(string); path != "" { @@ -425,7 +425,7 @@ func getClientId(d *schema.ResourceData) (*string, error) { return &clientId, nil } -func getClientSecret(d *schema.ResourceData) (*string, error) { +func getClientSecret(d *pluginsdk.ResourceData) (*string, error) { clientSecret := strings.TrimSpace(d.Get("client_secret").(string)) if path := d.Get("client_secret_file_path").(string); path != "" { diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 00de46dafc..ee5f7a09e3 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -15,6 +15,7 @@ import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/v2/terraform" "github.com/hashicorp/terraform-provider-azuread/internal/clients" + "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" ) func TestProvider(t *testing.T) { @@ -36,7 +37,7 @@ func TestAccProvider_cliAuth(t *testing.T) { ctx := context.Background() // Support only Azure CLI authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -74,7 +75,7 @@ func TestAccProvider_clientCertificateAuth(t *testing.T) { ctx := context.Background() // Support only client certificate authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -115,7 +116,7 @@ func TestAccProvider_clientCertificateInlineAuth(t *testing.T) { ctx := context.Background() // Support only client certificate authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { var certData []byte if encodedCert := d.Get("client_certificate").(string); encodedCert != "" { var err error @@ -181,7 +182,7 @@ func testAccProvider_clientSecretAuthFromEnvironment(t *testing.T) { ctx := context.Background() // Support only client secret authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -242,7 +243,7 @@ func testAccProvider_clientSecretAuthFromFiles(t *testing.T) { ctx := context.Background() // Support only client secret authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -304,7 +305,7 @@ func testAccProvider_genericOidcAuthFromEnvironment(t *testing.T) { ctx := context.Background() // Support only oidc authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -356,7 +357,7 @@ func testAccProvider_genericOidcAuthFromFiles(t *testing.T) { ctx := context.Background() // Support only oidc authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { @@ -407,7 +408,7 @@ func TestAccProvider_githubOidcAuth(t *testing.T) { ctx := context.Background() // Support only oidc authentication - provider.ConfigureContextFunc = func(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) { + provider.ConfigureContextFunc = func(ctx context.Context, d *pluginsdk.ResourceData) (interface{}, pluginsdk.Diagnostics) { envName := d.Get("environment").(string) env, err := environments.FromName(envName) if err != nil { diff --git a/internal/services/administrativeunits/administrative_unit_data_source.go b/internal/services/administrativeunits/administrative_unit_data_source.go index abca0d639c..9170f67b85 100644 --- a/internal/services/administrativeunits/administrative_unit_data_source.go +++ b/internal/services/administrativeunits/administrative_unit_data_source.go @@ -10,7 +10,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -70,7 +69,7 @@ func administrativeUnitDataSource() *pluginsdk.Resource { } } -func administrativeUnitDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient var administrativeUnit msgraph.AdministrativeUnit diff --git a/internal/services/administrativeunits/administrative_unit_member_resource.go b/internal/services/administrativeunits/administrative_unit_member_resource.go index 0cb7337280..5b426f6fb7 100644 --- a/internal/services/administrativeunits/administrative_unit_member_resource.go +++ b/internal/services/administrativeunits/administrative_unit_member_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/administrativeunits/parse" @@ -61,7 +60,7 @@ func administrativeUnitMemberResource() *pluginsdk.Resource { } } -func administrativeUnitMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -135,7 +134,7 @@ func administrativeUnitMemberResourceCreate(ctx context.Context, d *pluginsdk.Re return administrativeUnitMemberResourceRead(ctx, d, meta) } -func administrativeUnitMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient id, err := parse.AdministrativeUnitMemberID(d.Id()) @@ -158,7 +157,7 @@ func administrativeUnitMemberResourceRead(ctx context.Context, d *pluginsdk.Reso return nil } -func administrativeUnitMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient id, err := parse.AdministrativeUnitMemberID(d.Id()) diff --git a/internal/services/administrativeunits/administrative_unit_resource.go b/internal/services/administrativeunits/administrative_unit_resource.go index d985dac6bd..e397aa1317 100644 --- a/internal/services/administrativeunits/administrative_unit_resource.go +++ b/internal/services/administrativeunits/administrative_unit_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -122,7 +121,7 @@ func administrativeUnitResourceCustomizeDiff(ctx context.Context, diff *pluginsd return nil } -func administrativeUnitResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -211,7 +210,7 @@ func administrativeUnitResourceCreate(ctx context.Context, d *pluginsdk.Resource return administrativeUnitResourceRead(ctx, d, meta) } -func administrativeUnitResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient directoryObjectsClient := meta.(*clients.Client).AdministrativeUnits.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -298,7 +297,7 @@ func administrativeUnitResourceUpdate(ctx context.Context, d *pluginsdk.Resource return administrativeUnitResourceRead(ctx, d, meta) } -func administrativeUnitResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient administrativeUnit, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -333,7 +332,7 @@ func administrativeUnitResourceRead(ctx context.Context, d *pluginsdk.ResourceDa return nil } -func administrativeUnitResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient administrativeUnitId := d.Id() diff --git a/internal/services/administrativeunits/administrative_unit_role_member_resource.go b/internal/services/administrativeunits/administrative_unit_role_member_resource.go index e65c26e36b..eacee8b70f 100644 --- a/internal/services/administrativeunits/administrative_unit_role_member_resource.go +++ b/internal/services/administrativeunits/administrative_unit_role_member_resource.go @@ -10,7 +10,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/administrativeunits/parse" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -66,7 +65,7 @@ func administrativeUnitRoleMemberResource() *pluginsdk.Resource { } } -func administrativeUnitRoleMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitRoleMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient memberID := utils.String(d.Get("member_object_id").(string)) @@ -92,7 +91,7 @@ func administrativeUnitRoleMemberResourceCreate(ctx context.Context, d *pluginsd return administrativeUnitRoleMemberResourceRead(ctx, d, meta) } -func administrativeUnitRoleMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitRoleMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient id, err := parse.AdministrativeUnitRoleMemberID(d.Id()) @@ -115,7 +114,7 @@ func administrativeUnitRoleMemberResourceRead(ctx context.Context, d *pluginsdk. return nil } -func administrativeUnitRoleMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func administrativeUnitRoleMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AdministrativeUnits.AdministrativeUnitsClient id, err := parse.AdministrativeUnitRoleMemberID(d.Id()) diff --git a/internal/services/applications/application_certificate_resource.go b/internal/services/applications/application_certificate_resource.go index 63ed04b94c..fe1a4d9fe6 100644 --- a/internal/services/applications/application_certificate_resource.go +++ b/internal/services/applications/application_certificate_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" @@ -123,7 +122,7 @@ func applicationCertificateResource() *pluginsdk.Resource { } } -func applicationCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient objectId := d.Get("application_object_id").(string) @@ -211,7 +210,7 @@ func applicationCertificateResourceCreate(ctx context.Context, d *pluginsdk.Reso return applicationCertificateResourceRead(ctx, d, meta) } -func applicationCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.CertificateID(d.Id()) @@ -255,7 +254,7 @@ func applicationCertificateResourceRead(ctx context.Context, d *pluginsdk.Resour return nil } -func applicationCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.CertificateID(d.Id()) diff --git a/internal/services/applications/application_data_source.go b/internal/services/applications/application_data_source.go index 810bb5b7b5..603a9d43e1 100644 --- a/internal/services/applications/application_data_source.go +++ b/internal/services/applications/application_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -495,7 +494,7 @@ func applicationDataSource() *pluginsdk.Resource { } } -func applicationDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/applications/application_federated_identity_credential_resource.go b/internal/services/applications/application_federated_identity_credential_resource.go index 0fc68ac7a6..9efb1ca6f9 100644 --- a/internal/services/applications/application_federated_identity_credential_resource.go +++ b/internal/services/applications/application_federated_identity_credential_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" @@ -98,7 +97,7 @@ func applicationFederatedIdentityCredentialResource() *pluginsdk.Resource { } } -func applicationFederatedIdentityCredentialResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationFederatedIdentityCredentialResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient objectId := d.Get("application_object_id").(string) @@ -174,7 +173,7 @@ func applicationFederatedIdentityCredentialResourceCreate(ctx context.Context, d return applicationFederatedIdentityCredentialResourceRead(ctx, d, meta) } -func applicationFederatedIdentityCredentialResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationFederatedIdentityCredentialResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.FederatedIdentityCredentialID(d.Id()) @@ -201,7 +200,7 @@ func applicationFederatedIdentityCredentialResourceUpdate(ctx context.Context, d return applicationFederatedIdentityCredentialResourceRead(ctx, d, meta) } -func applicationFederatedIdentityCredentialResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationFederatedIdentityCredentialResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.FederatedIdentityCredentialID(d.Id()) @@ -231,7 +230,7 @@ func applicationFederatedIdentityCredentialResourceRead(ctx context.Context, d * return nil } -func applicationFederatedIdentityCredentialResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationFederatedIdentityCredentialResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.FederatedIdentityCredentialID(d.Id()) diff --git a/internal/services/applications/application_password_resource.go b/internal/services/applications/application_password_resource.go index beb304270a..260075f531 100644 --- a/internal/services/applications/application_password_resource.go +++ b/internal/services/applications/application_password_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/migrations" @@ -117,7 +116,7 @@ func applicationPasswordResource() *pluginsdk.Resource { } } -func applicationPasswordResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationPasswordResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient objectId := d.Get("application_object_id").(string) @@ -201,7 +200,7 @@ func applicationPasswordResourceCreate(ctx context.Context, d *pluginsdk.Resourc return applicationPasswordResourceRead(ctx, d, meta) } -func applicationPasswordResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationPasswordResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.PasswordID(d.Id()) @@ -255,7 +254,7 @@ func applicationPasswordResourceRead(ctx context.Context, d *pluginsdk.ResourceD return nil } -func applicationPasswordResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { //nolint +func applicationPasswordResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { //nolint client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.PasswordID(d.Id()) diff --git a/internal/services/applications/application_pre_authorized_resource.go b/internal/services/applications/application_pre_authorized_resource.go index fedd3b5894..1ec5d7968c 100644 --- a/internal/services/applications/application_pre_authorized_resource.go +++ b/internal/services/applications/application_pre_authorized_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/parse" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -72,7 +71,7 @@ func applicationPreAuthorizedResource() *pluginsdk.Resource { } } -func applicationPreAuthorizedResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationPreAuthorizedResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id := parse.NewApplicationPreAuthorizedID(d.Get("application_object_id").(string), d.Get("authorized_app_id").(string)) @@ -123,7 +122,7 @@ func applicationPreAuthorizedResourceCreate(ctx context.Context, d *pluginsdk.Re return applicationPreAuthorizedResourceRead(ctx, d, meta) } -func applicationPreAuthorizedResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationPreAuthorizedResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.ApplicationPreAuthorizedID(d.Id()) if err != nil { @@ -176,7 +175,7 @@ func applicationPreAuthorizedResourceUpdate(ctx context.Context, d *pluginsdk.Re return applicationPreAuthorizedResourceRead(ctx, d, meta) } -func applicationPreAuthorizedResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationPreAuthorizedResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.ApplicationPreAuthorizedID(d.Id()) if err != nil { @@ -219,7 +218,7 @@ func applicationPreAuthorizedResourceRead(ctx context.Context, d *pluginsdk.Reso return nil } -func applicationPreAuthorizedResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationPreAuthorizedResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient id, err := parse.ApplicationPreAuthorizedID(d.Id()) if err != nil { diff --git a/internal/services/applications/application_published_app_ids_data_source.go b/internal/services/applications/application_published_app_ids_data_source.go index 122376ec8b..9cdfef1d0a 100644 --- a/internal/services/applications/application_published_app_ids_data_source.go +++ b/internal/services/applications/application_published_app_ids_data_source.go @@ -8,14 +8,13 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/environments" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" ) func applicationPublishedAppIdsDataSource() *pluginsdk.Resource { return &pluginsdk.Resource{ - ReadContext: func(_ context.Context, d *pluginsdk.ResourceData, _ interface{}) diag.Diagnostics { + ReadContext: func(_ context.Context, d *pluginsdk.ResourceData, _ interface{}) pluginsdk.Diagnostics { tf.Set(d, "result", environments.PublishedApis) d.SetId("appIds") return nil diff --git a/internal/services/applications/application_resource.go b/internal/services/applications/application_resource.go index 533828caab..4f153e7018 100644 --- a/internal/services/applications/application_resource.go +++ b/internal/services/applications/application_resource.go @@ -16,7 +16,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/applications/migrations" @@ -167,19 +166,19 @@ func applicationResource() *pluginsdk.Resource { Type: pluginsdk.TypeInt, Optional: true, Default: 1, - ValidateDiagFunc: func(i interface{}, path cty.Path) (ret diag.Diagnostics) { + ValidateDiagFunc: func(i interface{}, path cty.Path) (ret pluginsdk.Diagnostics) { v, ok := i.(int) if !ok { - ret = append(ret, diag.Diagnostic{ - Severity: diag.Error, + ret = append(ret, pluginsdk.Diagnostic{ + Severity: pluginsdk.DiagError, Summary: "Expected an integer value", AttributePath: path, }) return } if v < 1 || v > 2 { - ret = append(ret, diag.Diagnostic{ - Severity: diag.Error, + ret = append(ret, pluginsdk.Diagnostic{ + Severity: pluginsdk.DiagError, Summary: "Value must be one of: 1, 2", AttributePath: path, }) @@ -896,7 +895,7 @@ func applicationDiffSuppress(k, old, new string, d *pluginsdk.ResourceData) bool return suppress } -func applicationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient appTemplatesClient := meta.(*clients.Client).Applications.ApplicationTemplatesClient directoryObjectsClient := meta.(*clients.Client).Applications.DirectoryObjectsClient @@ -1123,7 +1122,7 @@ func applicationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, m return applicationResourceRead(ctx, d, meta) } -func applicationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient tenantId := meta.(*clients.Client).TenantID applicationId := d.Id() @@ -1252,7 +1251,7 @@ func applicationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, m return applicationResourceRead(ctx, d, meta) } -func applicationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient app, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -1325,7 +1324,7 @@ func applicationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, met return nil } -func applicationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationsClient appId := d.Id() diff --git a/internal/services/applications/application_template_data_source.go b/internal/services/applications/application_template_data_source.go index 2987782f40..04e2d1a26f 100644 --- a/internal/services/applications/application_template_data_source.go +++ b/internal/services/applications/application_template_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -94,7 +93,7 @@ func applicationTemplateDataSource() *pluginsdk.Resource { } } -func applicationTemplateDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func applicationTemplateDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Applications.ApplicationTemplatesClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/applications/validate/tokens.go b/internal/services/applications/validate/tokens.go index 620e4fffde..326da3b870 100644 --- a/internal/services/applications/validate/tokens.go +++ b/internal/services/applications/validate/tokens.go @@ -8,11 +8,12 @@ import ( "github.com/hashicorp/go-cty/cty" "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" ) // RoleScopeClaimValue checks whether a value is valid for use in a `role` or `scp` claim, as used in App Roles and OAuth 2.0 Permission Scopes in Applications. // See https://docs.microsoft.com/en-us/graph/api/resources/approle?view=graph-rest-beta and https://docs.microsoft.com/en-us/graph/api/resources/permissionscope?view=graph-rest-beta -func RoleScopeClaimValue(i interface{}, path cty.Path) (ret diag.Diagnostics) { +func RoleScopeClaimValue(i interface{}, path cty.Path) (ret pluginsdk.Diagnostics) { v, ok := i.(string) if !ok { ret = append(ret, diag.Diagnostic{ diff --git a/internal/services/approleassignments/app_role_assignment_resource.go b/internal/services/approleassignments/app_role_assignment_resource.go index 9c39c707c0..b60b8f2fa2 100644 --- a/internal/services/approleassignments/app_role_assignment_resource.go +++ b/internal/services/approleassignments/app_role_assignment_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/approleassignments/parse" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -85,7 +84,7 @@ func appRoleAssignmentResource() *pluginsdk.Resource { } } -func appRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func appRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AppRoleAssignments.AppRoleAssignedToClient servicePrincipalsClient := meta.(*clients.Client).AppRoleAssignments.ServicePrincipalsClient @@ -123,7 +122,7 @@ func appRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceD return appRoleAssignmentResourceRead(ctx, d, meta) } -func appRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func appRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AppRoleAssignments.AppRoleAssignedToClient id, err := parse.AppRoleAssignmentID(d.Id()) @@ -168,7 +167,7 @@ func appRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceDat return nil } -func appRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func appRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).AppRoleAssignments.AppRoleAssignedToClient id, err := parse.AppRoleAssignmentID(d.Id()) diff --git a/internal/services/conditionalaccess/conditional_access_policy_resource.go b/internal/services/conditionalaccess/conditional_access_policy_resource.go index c0b133c13e..a4d3d38479 100644 --- a/internal/services/conditionalaccess/conditional_access_policy_resource.go +++ b/internal/services/conditionalaccess/conditional_access_policy_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -536,7 +535,7 @@ func conditionalAccessPolicyDiffSuppress(k, old, new string, d *pluginsdk.Resour return suppress } -func conditionalAccessPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func conditionalAccessPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.PoliciesClient properties := msgraph.ConditionalAccessPolicy{ @@ -567,7 +566,7 @@ func conditionalAccessPolicyResourceCreate(ctx context.Context, d *pluginsdk.Res return conditionalAccessPolicyResourceRead(ctx, d, meta) } -func conditionalAccessPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func conditionalAccessPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.PoliciesClient properties := msgraph.ConditionalAccessPolicy{ @@ -626,7 +625,7 @@ func conditionalAccessPolicyResourceUpdate(ctx context.Context, d *pluginsdk.Res return nil } -func conditionalAccessPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func conditionalAccessPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.PoliciesClient policy, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -649,7 +648,7 @@ func conditionalAccessPolicyResourceRead(ctx context.Context, d *pluginsdk.Resou return nil } -func conditionalAccessPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func conditionalAccessPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.PoliciesClient policyId := d.Id() diff --git a/internal/services/conditionalaccess/named_location_data_source.go b/internal/services/conditionalaccess/named_location_data_source.go index 2e7e161429..fdb7a828bf 100644 --- a/internal/services/conditionalaccess/named_location_data_source.go +++ b/internal/services/conditionalaccess/named_location_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -79,7 +78,7 @@ func namedLocationDataSource() *pluginsdk.Resource { } } -func namedLocationDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func namedLocationDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.NamedLocationsClient displayName := d.Get("display_name").(string) diff --git a/internal/services/conditionalaccess/named_location_resource.go b/internal/services/conditionalaccess/named_location_resource.go index 46ff8ef772..04ad311e18 100644 --- a/internal/services/conditionalaccess/named_location_resource.go +++ b/internal/services/conditionalaccess/named_location_resource.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -104,7 +103,7 @@ func namedLocationResource() *pluginsdk.Resource { } } -func namedLocationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func namedLocationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.NamedLocationsClient displayName := d.Get("display_name").(string) @@ -146,7 +145,7 @@ func namedLocationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, return namedLocationResourceRead(ctx, d, meta) } -func namedLocationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func namedLocationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.NamedLocationsClient base := msgraph.BaseNamedLocation{ @@ -235,7 +234,7 @@ func namedLocationResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, return namedLocationResourceRead(ctx, d, meta) } -func namedLocationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func namedLocationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.NamedLocationsClient result, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -273,7 +272,7 @@ func namedLocationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, m return nil } -func namedLocationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func namedLocationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ConditionalAccess.NamedLocationsClient namedLocationId := d.Id() diff --git a/internal/services/directoryobjects/directory_object_data_source.go b/internal/services/directoryobjects/directory_object_data_source.go index 9eb1c77e65..a13352f13e 100644 --- a/internal/services/directoryobjects/directory_object_data_source.go +++ b/internal/services/directoryobjects/directory_object_data_source.go @@ -9,7 +9,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -41,7 +40,7 @@ func directoryObjectDataSource() *pluginsdk.Resource { } } -func directoryObjectDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryObjectDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.DirectoryObjectsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() @@ -74,7 +73,7 @@ func directoryObjectDataSourceRead(ctx context.Context, d *pluginsdk.ResourceDat case odata.TypeServicePrincipal: tf.Set(d, "type", "ServicePrincipal") default: - return diag.Errorf("unknown object type %q returned for directory object with ID: %q", *directoryObject.ODataType, objectId) + return pluginsdk.DiagErrorf("unknown object type %q returned for directory object with ID: %q", *directoryObject.ODataType, objectId) } return nil diff --git a/internal/services/directoryroles/custom_directory_role_resource.go b/internal/services/directoryroles/custom_directory_role_resource.go index 5407ee8d31..225ac03c7c 100644 --- a/internal/services/directoryroles/custom_directory_role_resource.go +++ b/internal/services/directoryroles/custom_directory_role_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -110,7 +109,7 @@ func customDirectoryRoleResource() *pluginsdk.Resource { } } -func customDirectoryRoleResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func customDirectoryRoleResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleDefinitionsClient displayName := d.Get("display_name").(string) @@ -138,7 +137,7 @@ func customDirectoryRoleResourceCreate(ctx context.Context, d *pluginsdk.Resourc return customDirectoryRoleResourceRead(ctx, d, meta) } -func customDirectoryRoleResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func customDirectoryRoleResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleDefinitionsClient roleId := d.Id() @@ -164,7 +163,7 @@ func customDirectoryRoleResourceUpdate(ctx context.Context, d *pluginsdk.Resourc return customDirectoryRoleResourceRead(ctx, d, meta) } -func customDirectoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func customDirectoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleDefinitionsClient roleId := d.Id() @@ -192,7 +191,7 @@ func customDirectoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceD return nil } -func customDirectoryRoleResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func customDirectoryRoleResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleDefinitionsClient roleId := d.Id() diff --git a/internal/services/directoryroles/directory_role_assignment_resource.go b/internal/services/directoryroles/directory_role_assignment_resource.go index ef90c3cd7c..e6404b180e 100644 --- a/internal/services/directoryroles/directory_role_assignment_resource.go +++ b/internal/services/directoryroles/directory_role_assignment_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -102,7 +101,7 @@ func directoryRoleAssignmentResource() *pluginsdk.Resource { } } -func directoryRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleAssignmentsClient roleId := d.Get("role_id").(string) @@ -176,7 +175,7 @@ func directoryRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.Res return directoryRoleAssignmentResourceRead(ctx, d, meta) } -func directoryRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleAssignmentsClient id := d.Id() @@ -200,7 +199,7 @@ func directoryRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.Resou return nil } -func directoryRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleAssignmentsClient if _, err := client.Delete(ctx, d.Id()); err != nil { diff --git a/internal/services/directoryroles/directory_role_eligibility_schedule_request_resource.go b/internal/services/directoryroles/directory_role_eligibility_schedule_request_resource.go index a5ffcd476e..d955352f46 100644 --- a/internal/services/directoryroles/directory_role_eligibility_schedule_request_resource.go +++ b/internal/services/directoryroles/directory_role_eligibility_schedule_request_resource.go @@ -10,7 +10,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -76,7 +75,7 @@ func directoryRoleEligibilityScheduleRequestResource() *pluginsdk.Resource { } } -func directoryRoleEligibilityScheduleRequestResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleEligibilityScheduleRequestResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleEligibilityScheduleRequestClient roleDefinitionId := d.Get("role_definition_id").(string) @@ -128,7 +127,7 @@ func directoryRoleEligibilityScheduleRequestResourceCreate(ctx context.Context, return directoryRoleEligibilityScheduleRequestResourceRead(ctx, d, meta) } -func directoryRoleEligibilityScheduleRequestResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleEligibilityScheduleRequestResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleEligibilityScheduleRequestClient id := d.Id() @@ -150,7 +149,7 @@ func directoryRoleEligibilityScheduleRequestResourceRead(ctx context.Context, d return nil } -func directoryRoleEligibilityScheduleRequestResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleEligibilityScheduleRequestResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.RoleEligibilityScheduleRequestClient id := d.Id() diff --git a/internal/services/directoryroles/directory_role_member_resource.go b/internal/services/directoryroles/directory_role_member_resource.go index cd2320cea1..82d7395767 100644 --- a/internal/services/directoryroles/directory_role_member_resource.go +++ b/internal/services/directoryroles/directory_role_member_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/directoryroles/parse" @@ -65,7 +64,7 @@ func directoryRoleMemberResource() *pluginsdk.Resource { } } -func directoryRoleMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient directoryObjectsClient := meta.(*clients.Client).DirectoryRoles.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -137,7 +136,7 @@ func directoryRoleMemberResourceCreate(ctx context.Context, d *pluginsdk.Resourc return directoryRoleMemberResourceRead(ctx, d, meta) } -func directoryRoleMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient id, err := parse.DirectoryRoleMemberID(d.Id()) @@ -160,7 +159,7 @@ func directoryRoleMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceD return nil } -func directoryRoleMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient id, err := parse.DirectoryRoleMemberID(d.Id()) diff --git a/internal/services/directoryroles/directory_role_resource.go b/internal/services/directoryroles/directory_role_resource.go index 6be5285e93..f5f0c0c5e3 100644 --- a/internal/services/directoryroles/directory_role_resource.go +++ b/internal/services/directoryroles/directory_role_resource.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -70,7 +69,7 @@ func directoryRoleResource() *pluginsdk.Resource { } } -func directoryRoleResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient directoryRoleTemplatesClient := meta.(*clients.Client).DirectoryRoles.DirectoryRoleTemplatesClient displayName := d.Get("display_name").(string) @@ -149,7 +148,7 @@ func directoryRoleResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, return directoryRoleResourceRead(ctx, d, meta) } -func directoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient directoryRole, status, err := client.Get(ctx, d.Id()) @@ -173,7 +172,7 @@ func directoryRoleResourceRead(ctx context.Context, d *pluginsdk.ResourceData, m return nil } -func directoryRoleResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { // Directory roles cannot be deactivated or deleted, so this is a no-op return nil } diff --git a/internal/services/directoryroles/directory_role_templates_data_source.go b/internal/services/directoryroles/directory_role_templates_data_source.go index e142660a70..2a4db0c9e0 100644 --- a/internal/services/directoryroles/directory_role_templates_data_source.go +++ b/internal/services/directoryroles/directory_role_templates_data_source.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -65,7 +64,7 @@ func directoryRoleTemplatesDataSource() *pluginsdk.Resource { } } -func directoryRoleTemplatesDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRoleTemplatesDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRoleTemplatesClient directoryRoleTemplates, _, err := client.List(ctx) diff --git a/internal/services/directoryroles/directory_roles_data_source.go b/internal/services/directoryroles/directory_roles_data_source.go index f27768882e..c2a280192b 100644 --- a/internal/services/directoryroles/directory_roles_data_source.go +++ b/internal/services/directoryroles/directory_roles_data_source.go @@ -11,7 +11,6 @@ import ( "strings" "time" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -80,7 +79,7 @@ func directoryRolesDataSource() *pluginsdk.Resource { } } -func directoryRolesDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func directoryRolesDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).DirectoryRoles.DirectoryRolesClient directoryRoles, _, err := client.List(ctx) diff --git a/internal/services/groups/group_data_source.go b/internal/services/groups/group_data_source.go index c5d65ca307..e885d39c73 100644 --- a/internal/services/groups/group_data_source.go +++ b/internal/services/groups/group_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -248,7 +247,7 @@ func groupDataSource() *pluginsdk.Resource { } } -func groupDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/groups/group_member_resource.go b/internal/services/groups/group_member_resource.go index 5696c3dc39..cd75dd80e1 100644 --- a/internal/services/groups/group_member_resource.go +++ b/internal/services/groups/group_member_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/groups/parse" @@ -62,7 +61,7 @@ func groupMemberResource() *pluginsdk.Resource { } } -func groupMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -114,7 +113,7 @@ func groupMemberResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, m return groupMemberResourceRead(ctx, d, meta) } -func groupMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient id, err := parse.GroupMemberID(d.Id()) @@ -149,7 +148,7 @@ func groupMemberResourceRead(ctx context.Context, d *pluginsdk.ResourceData, met return nil } -func groupMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupMemberResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient id, err := parse.GroupMemberID(d.Id()) diff --git a/internal/services/groups/group_resource.go b/internal/services/groups/group_resource.go index 64ea810304..23ab523d87 100644 --- a/internal/services/groups/group_resource.go +++ b/internal/services/groups/group_resource.go @@ -15,7 +15,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -439,7 +438,7 @@ func groupResourceCustomizeDiff(ctx context.Context, diff *pluginsdk.ResourceDif return nil } -func groupResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient administrativeUnitsClient := meta.(*clients.Client).Groups.AdministrativeUnitsClient @@ -932,7 +931,7 @@ func groupResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta in return groupResourceRead(ctx, d, meta) } -func groupResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient directoryObjectsClient := meta.(*clients.Client).Groups.DirectoryObjectsClient administrativeUnitClient := meta.(*clients.Client).Groups.AdministrativeUnitsClient @@ -1247,7 +1246,7 @@ func groupResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta in return groupResourceRead(ctx, d, meta) } -func groupResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient group, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -1364,7 +1363,7 @@ func groupResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta inte return nil } -func groupResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient groupId := d.Id() diff --git a/internal/services/groups/groups_data_source.go b/internal/services/groups/groups_data_source.go index d8b582b78b..c04762b3db 100644 --- a/internal/services/groups/groups_data_source.go +++ b/internal/services/groups/groups_data_source.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -99,7 +98,7 @@ func groupsDataSource() *pluginsdk.Resource { } } -func groupsDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func groupsDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Groups.GroupsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/identitygovernance/access_package_assignment_policy_resource.go b/internal/services/identitygovernance/access_package_assignment_policy_resource.go index ec90209c6d..0d5a704c23 100644 --- a/internal/services/identitygovernance/access_package_assignment_policy_resource.go +++ b/internal/services/identitygovernance/access_package_assignment_policy_resource.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -348,7 +347,7 @@ func accessPackageAssignmentPolicyResource() *pluginsdk.Resource { } } -func accessPackageAssignmentPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageAssignmentPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageAssignmentPolicyClient var properties msgraph.AccessPackageAssignmentPolicy @@ -367,7 +366,7 @@ func accessPackageAssignmentPolicyResourceCreate(ctx context.Context, d *plugins return accessPackageAssignmentPolicyResourceRead(ctx, d, meta) } -func accessPackageAssignmentPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageAssignmentPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageAssignmentPolicyClient var properties msgraph.AccessPackageAssignmentPolicy @@ -386,7 +385,7 @@ func accessPackageAssignmentPolicyResourceUpdate(ctx context.Context, d *plugins return accessPackageAssignmentPolicyResourceRead(ctx, d, meta) } -func accessPackageAssignmentPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageAssignmentPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageAssignmentPolicyClient objectId := d.Id() @@ -420,7 +419,7 @@ func accessPackageAssignmentPolicyResourceRead(ctx context.Context, d *pluginsdk return nil } -func accessPackageAssignmentPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageAssignmentPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageAssignmentPolicyClient accessPackageAssignmentPolicyId := d.Id() diff --git a/internal/services/identitygovernance/access_package_catalog_data_source.go b/internal/services/identitygovernance/access_package_catalog_data_source.go index 450a5cc0c5..377dc9b176 100644 --- a/internal/services/identitygovernance/access_package_catalog_data_source.go +++ b/internal/services/identitygovernance/access_package_catalog_data_source.go @@ -10,7 +10,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -65,7 +64,7 @@ func accessPackageCatalogDataSource() *pluginsdk.Resource { } } -func accessPackageCatalogDataRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogDataRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient objectId := d.Get("object_id").(string) diff --git a/internal/services/identitygovernance/access_package_catalog_resource.go b/internal/services/identitygovernance/access_package_catalog_resource.go index 36362198d4..1dc8546cef 100644 --- a/internal/services/identitygovernance/access_package_catalog_resource.go +++ b/internal/services/identitygovernance/access_package_catalog_resource.go @@ -13,7 +13,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -78,7 +77,7 @@ func accessPackageCatalogResource() *pluginsdk.Resource { } } -func accessPackageCatalogResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient displayName := d.Get("display_name").(string) @@ -105,7 +104,7 @@ func accessPackageCatalogResourceCreate(ctx context.Context, d *pluginsdk.Resour return accessPackageCatalogResourceRead(ctx, d, meta) } -func accessPackageCatalogResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient objectId := d.Id() @@ -132,7 +131,7 @@ func accessPackageCatalogResourceUpdate(ctx context.Context, d *pluginsdk.Resour return accessPackageCatalogResourceRead(ctx, d, meta) } -func accessPackageCatalogResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient objectId := d.Id() @@ -160,7 +159,7 @@ func accessPackageCatalogResourceRead(ctx context.Context, d *pluginsdk.Resource return nil } -func accessPackageCatalogResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient accessPackageCatalogId := d.Id() diff --git a/internal/services/identitygovernance/access_package_catalog_role_assignment_resource.go b/internal/services/identitygovernance/access_package_catalog_role_assignment_resource.go index 98557c8007..5fbabcc528 100644 --- a/internal/services/identitygovernance/access_package_catalog_role_assignment_resource.go +++ b/internal/services/identitygovernance/access_package_catalog_role_assignment_resource.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -71,7 +70,7 @@ func accessPackageCatalogRoleAssignmentResource() *pluginsdk.Resource { } } -func accessPackageCatalogRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogRoleAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogRoleAssignmentsClient catalogId := d.Get("catalog_id").(string) @@ -97,7 +96,7 @@ func accessPackageCatalogRoleAssignmentResourceCreate(ctx context.Context, d *pl return accessPackageCatalogRoleAssignmentResourceRead(ctx, d, meta) } -func accessPackageCatalogRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogRoleAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogRoleAssignmentsClient id := d.Id() @@ -120,7 +119,7 @@ func accessPackageCatalogRoleAssignmentResourceRead(ctx context.Context, d *plug return nil } -func accessPackageCatalogRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogRoleAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogRoleAssignmentsClient if _, err := client.Delete(ctx, d.Id()); err != nil { diff --git a/internal/services/identitygovernance/access_package_catalog_role_data_source.go b/internal/services/identitygovernance/access_package_catalog_role_data_source.go index e980244203..6aab51e479 100644 --- a/internal/services/identitygovernance/access_package_catalog_role_data_source.go +++ b/internal/services/identitygovernance/access_package_catalog_role_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -58,7 +57,7 @@ func accessPackageCatalogRoleDataSource() *pluginsdk.Resource { } } -func accessPackageCatalogRoleDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageCatalogRoleDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogRoleClient var role msgraph.UnifiedRoleDefinition diff --git a/internal/services/identitygovernance/access_package_data_source.go b/internal/services/identitygovernance/access_package_data_source.go index 97626845d2..8e16e0c0ef 100644 --- a/internal/services/identitygovernance/access_package_data_source.go +++ b/internal/services/identitygovernance/access_package_data_source.go @@ -9,7 +9,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -69,7 +68,7 @@ func accessPackageDataSource() *pluginsdk.Resource { } } -func accessPackageDataRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageDataRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageClient var err error diff --git a/internal/services/identitygovernance/access_package_resource.go b/internal/services/identitygovernance/access_package_resource.go index 5eeb6f1586..661d301af5 100644 --- a/internal/services/identitygovernance/access_package_resource.go +++ b/internal/services/identitygovernance/access_package_resource.go @@ -12,7 +12,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -78,7 +77,7 @@ func accessPackageResource() *pluginsdk.Resource { } } -func accessPackageResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageClient accessPackageCatalogClient := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient @@ -108,7 +107,7 @@ func accessPackageResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, return accessPackageResourceRead(ctx, d, meta) } -func accessPackageResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageClient accessPackageCatalogClient := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient @@ -139,7 +138,7 @@ func accessPackageResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, return accessPackageResourceRead(ctx, d, meta) } -func accessPackageResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageClient objectId := d.Id() @@ -163,7 +162,7 @@ func accessPackageResourceRead(ctx context.Context, d *pluginsdk.ResourceData, m return nil } -func accessPackageResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageClient accessPackageId := d.Id() diff --git a/internal/services/identitygovernance/access_package_resource_catalog_association_resource.go b/internal/services/identitygovernance/access_package_resource_catalog_association_resource.go index d0775aeb4b..ee3fe903aa 100644 --- a/internal/services/identitygovernance/access_package_resource_catalog_association_resource.go +++ b/internal/services/identitygovernance/access_package_resource_catalog_association_resource.go @@ -10,7 +10,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/identitygovernance/parse" "github.com/hashicorp/terraform-provider-azuread/internal/services/identitygovernance/validate" @@ -59,7 +58,7 @@ func accessPackageResourceCatalogAssociationResource() *pluginsdk.Resource { } } -func accessPackageResourceCatalogAssociationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceCatalogAssociationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRequestClient accessPackageCatalogClient := meta.(*clients.Client).IdentityGovernance.AccessPackageCatalogClient resourceClient := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceClient @@ -103,7 +102,7 @@ func accessPackageResourceCatalogAssociationResourceCreate(ctx context.Context, return accessPackageResourceCatalogAssociationResourceRead(ctx, d, meta) } -func accessPackageResourceCatalogAssociationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceCatalogAssociationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { resourceClient := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceClient id, err := parse.AccessPackageResourceCatalogAssociationID(d.Id()) @@ -129,7 +128,7 @@ func accessPackageResourceCatalogAssociationResourceRead(ctx context.Context, d return nil } -func accessPackageResourceCatalogAssociationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourceCatalogAssociationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRequestClient resourceClient := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceClient diff --git a/internal/services/identitygovernance/access_package_resource_package_association_resource.go b/internal/services/identitygovernance/access_package_resource_package_association_resource.go index 5e6bc236c8..e3fe563b11 100644 --- a/internal/services/identitygovernance/access_package_resource_package_association_resource.go +++ b/internal/services/identitygovernance/access_package_resource_package_association_resource.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/identitygovernance/parse" "github.com/hashicorp/terraform-provider-azuread/internal/services/identitygovernance/validate" @@ -67,7 +66,7 @@ func accessPackageResourcePackageAssociationResource() *pluginsdk.Resource { } } -func accessPackageResourcePackageAssociationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourcePackageAssociationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRoleScopeClient resourceClient := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceClient @@ -113,7 +112,7 @@ func accessPackageResourcePackageAssociationResourceCreate(ctx context.Context, return accessPackageResourcePackageAssociationResourceRead(ctx, d, meta) } -func accessPackageResourcePackageAssociationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourcePackageAssociationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRoleScopeClient accessPackageClient := meta.(*clients.Client).IdentityGovernance.AccessPackageClient @@ -146,7 +145,7 @@ func accessPackageResourcePackageAssociationResourceRead(ctx context.Context, d return nil } -func accessPackageResourcePackageAssociationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func accessPackageResourcePackageAssociationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).IdentityGovernance.AccessPackageResourceRoleScopeClient id, err := parse.AccessPackageResourcePackageAssociationID(d.Id()) diff --git a/internal/services/invitations/invitation_resource.go b/internal/services/invitations/invitation_resource.go index 9cc1797153..7d3975ad85 100644 --- a/internal/services/invitations/invitation_resource.go +++ b/internal/services/invitations/invitation_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -125,7 +124,7 @@ func invitationResource() *pluginsdk.Resource { } } -func invitationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func invitationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Invitations.InvitationsClient usersClient := meta.(*clients.Client).Invitations.UsersClient @@ -194,7 +193,7 @@ func invitationResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, me return invitationResourceRead(ctx, d, meta) } -func invitationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func invitationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Invitations.UsersClient userID := d.Get("user_id").(string) @@ -215,7 +214,7 @@ func invitationResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta return nil } -func invitationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func invitationResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Invitations.UsersClient userID := d.Get("user_id").(string) diff --git a/internal/services/policies/claims_mapping_policy_resource.go b/internal/services/policies/claims_mapping_policy_resource.go index 926ea12965..0d925e8abf 100644 --- a/internal/services/policies/claims_mapping_policy_resource.go +++ b/internal/services/policies/claims_mapping_policy_resource.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -52,7 +51,7 @@ func claimsMappingPolicyResource() *pluginsdk.Resource { } } -func claimsMappingPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func claimsMappingPolicyResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Policies.ClaimsMappingPolicyClient claimsMappingPolicy := msgraph.ClaimsMappingPolicy{ @@ -73,7 +72,7 @@ func claimsMappingPolicyResourceCreate(ctx context.Context, d *pluginsdk.Resourc return claimsMappingPolicyResourceRead(ctx, d, meta) } -func claimsMappingPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func claimsMappingPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Policies.ClaimsMappingPolicyClient objectId := d.Id() @@ -94,7 +93,7 @@ func claimsMappingPolicyResourceRead(ctx context.Context, d *pluginsdk.ResourceD return nil } -func claimsMappingPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func claimsMappingPolicyResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Policies.ClaimsMappingPolicyClient objectId := d.Id() @@ -113,7 +112,7 @@ func claimsMappingPolicyResourceUpdate(ctx context.Context, d *pluginsdk.Resourc return claimsMappingPolicyResourceRead(ctx, d, meta) } -func claimsMappingPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func claimsMappingPolicyResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Policies.ClaimsMappingPolicyClient objectId := d.Id() diff --git a/internal/services/serviceprincipals/service_principal_certificate_resource.go b/internal/services/serviceprincipals/service_principal_certificate_resource.go index cbc23abbef..1cef63e58c 100644 --- a/internal/services/serviceprincipals/service_principal_certificate_resource.go +++ b/internal/services/serviceprincipals/service_principal_certificate_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/parse" @@ -123,7 +122,7 @@ func servicePrincipalCertificateResource() *pluginsdk.Resource { } } -func servicePrincipalCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Get("service_principal_id").(string) @@ -211,7 +210,7 @@ func servicePrincipalCertificateResourceCreate(ctx context.Context, d *pluginsdk return servicePrincipalCertificateResourceRead(ctx, d, meta) } -func servicePrincipalCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.CertificateID(d.Id()) @@ -255,7 +254,7 @@ func servicePrincipalCertificateResourceRead(ctx context.Context, d *pluginsdk.R return nil } -func servicePrincipalCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.CertificateID(d.Id()) diff --git a/internal/services/serviceprincipals/service_principal_claims_mapping_policy_assignment_resource.go b/internal/services/serviceprincipals/service_principal_claims_mapping_policy_assignment_resource.go index 7422d64a4f..66158f9203 100644 --- a/internal/services/serviceprincipals/service_principal_claims_mapping_policy_assignment_resource.go +++ b/internal/services/serviceprincipals/service_principal_claims_mapping_policy_assignment_resource.go @@ -10,7 +10,6 @@ import ( "net/http" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/parse" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -48,7 +47,7 @@ func servicePrincipalClaimsMappingPolicyAssignmentResource() *pluginsdk.Resource } } -func servicePrincipalClaimsMappingPolicyAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalClaimsMappingPolicyAssignmentResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient tenantId := meta.(*clients.Client).TenantID @@ -89,7 +88,7 @@ func servicePrincipalClaimsMappingPolicyAssignmentResourceCreate(ctx context.Con return servicePrincipalClaimsMappingPolicyAssignmentResourceRead(ctx, d, meta) } -func servicePrincipalClaimsMappingPolicyAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalClaimsMappingPolicyAssignmentResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.ClaimsMappingPolicyAssignmentID(d.Id()) @@ -132,7 +131,7 @@ func servicePrincipalClaimsMappingPolicyAssignmentResourceRead(ctx context.Conte return nil } -func servicePrincipalClaimsMappingPolicyAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalClaimsMappingPolicyAssignmentResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.ClaimsMappingPolicyAssignmentID(d.Id()) diff --git a/internal/services/serviceprincipals/service_principal_data_source.go b/internal/services/serviceprincipals/service_principal_data_source.go index 7c2c0adfdd..86417b3b3e 100644 --- a/internal/services/serviceprincipals/service_principal_data_source.go +++ b/internal/services/serviceprincipals/service_principal_data_source.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -281,7 +280,7 @@ func servicePrincipalData() *pluginsdk.Resource { } } -func servicePrincipalDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/serviceprincipals/service_principal_delegated_permission_grant_resource.go b/internal/services/serviceprincipals/service_principal_delegated_permission_grant_resource.go index 0a0964c55c..1a6a25d8f9 100644 --- a/internal/services/serviceprincipals/service_principal_delegated_permission_grant_resource.go +++ b/internal/services/serviceprincipals/service_principal_delegated_permission_grant_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -81,7 +80,7 @@ func servicePrincipalDelegatedPermissionGrantResource() *pluginsdk.Resource { } } -func servicePrincipalDelegatedPermissionGrantResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalDelegatedPermissionGrantResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.DelegatedPermissionGrantsClient servicePrincipalsClient := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient @@ -129,7 +128,7 @@ func servicePrincipalDelegatedPermissionGrantResourceCreate(ctx context.Context, return servicePrincipalDelegatedPermissionGrantResourceRead(ctx, d, meta) } -func servicePrincipalDelegatedPermissionGrantResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalDelegatedPermissionGrantResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.DelegatedPermissionGrantsClient properties := msgraph.DelegatedPermissionGrant{ @@ -144,7 +143,7 @@ func servicePrincipalDelegatedPermissionGrantResourceUpdate(ctx context.Context, return servicePrincipalDelegatedPermissionGrantResourceRead(ctx, d, meta) } -func servicePrincipalDelegatedPermissionGrantResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalDelegatedPermissionGrantResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.DelegatedPermissionGrantsClient delegatedPermissionGrant, status, err := client.Get(ctx, d.Id(), odata.Query{}) @@ -165,7 +164,7 @@ func servicePrincipalDelegatedPermissionGrantResourceRead(ctx context.Context, d return nil } -func servicePrincipalDelegatedPermissionGrantResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalDelegatedPermissionGrantResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.DelegatedPermissionGrantsClient id := d.Id() diff --git a/internal/services/serviceprincipals/service_principal_password_resource.go b/internal/services/serviceprincipals/service_principal_password_resource.go index 17bae881b5..86b350283d 100644 --- a/internal/services/serviceprincipals/service_principal_password_resource.go +++ b/internal/services/serviceprincipals/service_principal_password_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/migrations" @@ -117,7 +116,7 @@ func servicePrincipalPasswordResource() *pluginsdk.Resource { } } -func servicePrincipalPasswordResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalPasswordResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Get("service_principal_id").(string) @@ -201,7 +200,7 @@ func servicePrincipalPasswordResourceCreate(ctx context.Context, d *pluginsdk.Re return servicePrincipalPasswordResourceRead(ctx, d, meta) } -func servicePrincipalPasswordResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalPasswordResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.PasswordID(d.Id()) @@ -254,7 +253,7 @@ func servicePrincipalPasswordResourceRead(ctx context.Context, d *pluginsdk.Reso return nil } -func servicePrincipalPasswordResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalPasswordResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.PasswordID(d.Id()) diff --git a/internal/services/serviceprincipals/service_principal_resource.go b/internal/services/serviceprincipals/service_principal_resource.go index 48c90fe1b6..2a6d1e0e45 100644 --- a/internal/services/serviceprincipals/service_principal_resource.go +++ b/internal/services/serviceprincipals/service_principal_resource.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -350,7 +349,7 @@ func servicePrincipalDiffSuppress(k, old, new string, d *pluginsdk.ResourceData) return suppress } -func servicePrincipalResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient directoryObjectsClient := meta.(*clients.Client).ServicePrincipals.DirectoryObjectsClient callerId := meta.(*clients.Client).ObjectID @@ -507,7 +506,7 @@ func servicePrincipalResourceCreate(ctx context.Context, d *pluginsdk.ResourceDa return servicePrincipalResourceRead(ctx, d, meta) } -func servicePrincipalResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient tenantId := meta.(*clients.Client).TenantID @@ -577,7 +576,7 @@ func servicePrincipalResourceUpdate(ctx context.Context, d *pluginsdk.ResourceDa return servicePrincipalResourceRead(ctx, d, meta) } -func servicePrincipalResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Id() @@ -639,7 +638,7 @@ func servicePrincipalResourceRead(ctx context.Context, d *pluginsdk.ResourceData return nil } -func servicePrincipalResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient servicePrincipalId := d.Id() diff --git a/internal/services/serviceprincipals/service_principal_token_signing_certificate_resource.go b/internal/services/serviceprincipals/service_principal_token_signing_certificate_resource.go index 30a2976975..37b5a30579 100644 --- a/internal/services/serviceprincipals/service_principal_token_signing_certificate_resource.go +++ b/internal/services/serviceprincipals/service_principal_token_signing_certificate_resource.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/parse" @@ -98,7 +97,7 @@ func servicePrincipalTokenSigningCertificateResource() *pluginsdk.Resource { } } -func servicePrincipalTokenSigningCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalTokenSigningCertificateResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Get("service_principal_id").(string) @@ -173,7 +172,7 @@ func servicePrincipalTokenSigningCertificateResourceCreate(ctx context.Context, return servicePrincipalTokenSigningCertificateResourceRead(ctx, d, meta) } -func servicePrincipalTokenSigningCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalTokenSigningCertificateResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.SigningCertificateID(d.Id()) @@ -232,7 +231,7 @@ func servicePrincipalTokenSigningCertificateResourceRead(ctx context.Context, d return nil } -func servicePrincipalTokenSigningCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalTokenSigningCertificateResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient id, err := parse.SigningCertificateID(d.Id()) diff --git a/internal/services/serviceprincipals/service_principals_data_source.go b/internal/services/serviceprincipals/service_principals_data_source.go index e520d8f51d..48f6495a38 100644 --- a/internal/services/serviceprincipals/service_principals_data_source.go +++ b/internal/services/serviceprincipals/service_principals_data_source.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -174,7 +173,7 @@ func servicePrincipalsDataSource() *pluginsdk.Resource { } } -func servicePrincipalsDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func servicePrincipalsDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/serviceprincipals/synchronization_job_resource.go b/internal/services/serviceprincipals/synchronization_job_resource.go index 93e8f88169..65d82c5f3b 100644 --- a/internal/services/serviceprincipals/synchronization_job_resource.go +++ b/internal/services/serviceprincipals/synchronization_job_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/parse" @@ -91,7 +90,7 @@ func synchronizationJobResource() *pluginsdk.Resource { } } -func synchronizationJobResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationJobResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient spClient := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Get("service_principal_id").(string) @@ -165,7 +164,7 @@ func synchronizationJobResourceCreate(ctx context.Context, d *pluginsdk.Resource return synchronizationJobResourceRead(ctx, d, meta) } -func synchronizationJobResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationJobResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient id, err := parse.SynchronizationJobID(d.Id()) @@ -189,7 +188,7 @@ func synchronizationJobResourceRead(ctx context.Context, d *pluginsdk.ResourceDa return nil } -func synchronizationJobResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationJobResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient id, err := parse.SynchronizationJobID(d.Id()) if err != nil { @@ -211,7 +210,7 @@ func synchronizationJobResourceUpdate(ctx context.Context, d *pluginsdk.Resource return synchronizationJobResourceRead(ctx, d, meta) } -func synchronizationJobResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationJobResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient id, err := parse.SynchronizationJobID(d.Id()) diff --git a/internal/services/serviceprincipals/synchronization_secret_resource.go b/internal/services/serviceprincipals/synchronization_secret_resource.go index 3599ce6231..290fc4cb47 100644 --- a/internal/services/serviceprincipals/synchronization_secret_resource.go +++ b/internal/services/serviceprincipals/synchronization_secret_resource.go @@ -12,7 +12,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/services/serviceprincipals/parse" @@ -70,7 +69,7 @@ func synchronizationSecretResource() *pluginsdk.Resource { } } -func synchronizationSecretResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationSecretResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient spClient := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient objectId := d.Get("service_principal_id").(string) @@ -135,12 +134,12 @@ func synchronizationSecretResourceCreate(ctx context.Context, d *pluginsdk.Resou return synchronizationSecretResourceRead(ctx, d, meta) } -func synchronizationSecretResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationSecretResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { // Update is same as create return synchronizationSecretResourceCreate(ctx, d, meta) } -func synchronizationSecretResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationSecretResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient id, err := parse.SynchronizationSecretID(d.Id()) @@ -162,7 +161,7 @@ func synchronizationSecretResourceRead(ctx context.Context, d *pluginsdk.Resourc return nil } -func synchronizationSecretResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func synchronizationSecretResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).ServicePrincipals.SynchronizationJobClient spClient := meta.(*clients.Client).ServicePrincipals.ServicePrincipalsClient diff --git a/internal/services/userflows/user_flow_attribute_resource.go b/internal/services/userflows/user_flow_attribute_resource.go index 9961b91874..6381002d33 100644 --- a/internal/services/userflows/user_flow_attribute_resource.go +++ b/internal/services/userflows/user_flow_attribute_resource.go @@ -13,7 +13,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -74,7 +73,7 @@ func userFlowAttributeResource() *pluginsdk.Resource { } } -func userFlowAttributeResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userFlowAttributeResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).UserFlows.UserFlowAttributesClient displayName := d.Get("display_name").(string) @@ -110,7 +109,7 @@ func userFlowAttributeResourceCreate(ctx context.Context, d *pluginsdk.ResourceD return userFlowAttributeResourceRead(ctx, d, meta) } -func userFlowAttributeResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userFlowAttributeResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).UserFlows.UserFlowAttributesClient id := d.Id() @@ -126,7 +125,7 @@ func userFlowAttributeResourceUpdate(ctx context.Context, d *pluginsdk.ResourceD return userFlowAttributeResourceRead(ctx, d, meta) } -func userFlowAttributeResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userFlowAttributeResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).UserFlows.UserFlowAttributesClient id := d.Id() @@ -148,7 +147,7 @@ func userFlowAttributeResourceRead(ctx context.Context, d *pluginsdk.ResourceDat return nil } -func userFlowAttributeResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userFlowAttributeResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).UserFlows.UserFlowAttributesClient id := d.Id() diff --git a/internal/services/users/user_data_source.go b/internal/services/users/user_data_source.go index fc4486d78c..0ccb619903 100644 --- a/internal/services/users/user_data_source.go +++ b/internal/services/users/user_data_source.go @@ -11,7 +11,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -317,7 +316,7 @@ func userDataSource() *pluginsdk.Resource { } } -func userDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/services/users/user_resource.go b/internal/services/users/user_resource.go index 27bf53ade4..33e9a774d5 100644 --- a/internal/services/users/user_resource.go +++ b/internal/services/users/user_resource.go @@ -14,7 +14,6 @@ import ( "github.com/hashicorp/go-azure-sdk/sdk/odata" "github.com/hashicorp/go-uuid" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/helpers" "github.com/hashicorp/terraform-provider-azuread/internal/tf" @@ -390,7 +389,7 @@ func userResourceCustomizeDiff(ctx context.Context, diff *pluginsdk.ResourceDiff return nil } -func userResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient directoryObjectsClient := meta.(*clients.Client).Users.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -498,7 +497,7 @@ func userResourceCreate(ctx context.Context, d *pluginsdk.ResourceData, meta int return userResourceRead(ctx, d, meta) } -func userResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient directoryObjectsClient := meta.(*clients.Client).Users.DirectoryObjectsClient tenantId := meta.(*clients.Client).TenantID @@ -589,7 +588,7 @@ func userResourceUpdate(ctx context.Context, d *pluginsdk.ResourceData, meta int return userResourceRead(ctx, d, meta) } -func userResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient objectId := d.Id() @@ -683,7 +682,7 @@ func userResourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta inter return nil } -func userResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func userResourceDelete(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient userId := d.Id() diff --git a/internal/services/users/users_data_source.go b/internal/services/users/users_data_source.go index bd77af1f99..0ada4dd623 100644 --- a/internal/services/users/users_data_source.go +++ b/internal/services/users/users_data_source.go @@ -14,7 +14,6 @@ import ( "time" "github.com/hashicorp/go-azure-sdk/sdk/odata" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" "github.com/hashicorp/terraform-provider-azuread/internal/clients" "github.com/hashicorp/terraform-provider-azuread/internal/tf" "github.com/hashicorp/terraform-provider-azuread/internal/tf/pluginsdk" @@ -175,7 +174,7 @@ func usersData() *pluginsdk.Resource { } } -func usersDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) diag.Diagnostics { +func usersDataSourceRead(ctx context.Context, d *pluginsdk.ResourceData, meta interface{}) pluginsdk.Diagnostics { client := meta.(*clients.Client).Users.UsersClient client.BaseClient.DisableRetries = true defer func() { client.BaseClient.DisableRetries = false }() diff --git a/internal/tf/pluginsdk/diag.go b/internal/tf/pluginsdk/diag.go new file mode 100644 index 0000000000..2bcfd452df --- /dev/null +++ b/internal/tf/pluginsdk/diag.go @@ -0,0 +1,40 @@ +package pluginsdk + +import ( + "fmt" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" +) + +const ( + DiagError = diag.Error + DiagWarning = diag.Warning +) + +type ( + Diagnostic = diag.Diagnostic + Diagnostics = diag.Diagnostics +) + +// DiagFromErr is a wrapper around the DiagFromErr function in the Plugin SDK diag package +func DiagFromErr(err error) Diagnostics { + if err == nil { + return nil + } + return Diagnostics{ + Diagnostic{ + Severity: DiagError, + Summary: err.Error(), + }, + } +} + +// DiagErrorf is a wrapper around the DiagErrorf function in the Plugin SDK diag package +func DiagErrorf(format string, a ...interface{}) Diagnostics { + return Diagnostics{ + Diagnostic{ + Severity: DiagError, + Summary: fmt.Sprintf(format, a...), + }, + } +}