diff --git a/.golangci.yml b/.golangci.yml index c468a41e30..abe4f0dab2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -28,6 +28,8 @@ linters: linters-settings: errcheck: ignore: github.com/hashicorp/terraform/helper/schema:ForceNew|Set,fmt:.*,io:Close + misspell: + locale: UK run: modules-download-mode: vendor \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index f54cec9e13..4082308ab4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -31,9 +31,9 @@ fmt: fmtcheck: @sh "$(CURDIR)/scripts/gofmtcheck.sh" -goimport: +goimports: @echo "==> Fixing imports code with goimports..." - goimports -w $(PKG_NAME)/ + goimports -local "github.com/terraform-providers/terraform-provider-azuread/azuread" -w $(PKG_NAME)/ lint: @echo "==> Checking source code against linters..." diff --git a/azuread/config.go b/azuread/config.go index 014ced5dca..6a7a30d01c 100644 --- a/azuread/config.go +++ b/azuread/config.go @@ -15,8 +15,9 @@ import ( "github.com/hashicorp/go-azure-helpers/authentication" "github.com/hashicorp/go-azure-helpers/sender" "github.com/hashicorp/terraform/httpclient" - "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/version" + + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" ) // ArmClient contains the handles to all the specific Azure ADger resource classes' respective clients. diff --git a/azuread/data_group.go b/azuread/data_group.go index 11ad008f2c..af2557ab88 100644 --- a/azuread/data_group.go +++ b/azuread/data_group.go @@ -5,6 +5,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate" ) diff --git a/azuread/data_user.go b/azuread/data_user.go index afa1f37f29..d34c0dfcca 100644 --- a/azuread/data_user.go +++ b/azuread/data_user.go @@ -5,6 +5,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate" ) diff --git a/azuread/helpers/ar/response_test.go b/azuread/helpers/ar/response_test.go index bb2e095f03..f0c9228222 100644 --- a/azuread/helpers/ar/response_test.go +++ b/azuread/helpers/ar/response_test.go @@ -44,7 +44,7 @@ type testNetError struct { temporary bool } -// testNetError fulfills net.Error interface +// testNetError fulfils net.Error interface func (e testNetError) Error() string { return "testError" } func (e testNetError) Timeout() bool { return e.timeout } func (e testNetError) Temporary() bool { return e.temporary } diff --git a/azuread/helpers/graph/credentials.go b/azuread/helpers/graph/credentials.go index 032d086c7a..2b47835c40 100644 --- a/azuread/helpers/graph/credentials.go +++ b/azuread/helpers/graph/credentials.go @@ -10,6 +10,7 @@ import ( "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate" ) diff --git a/azuread/helpers/graph/replication.go b/azuread/helpers/graph/replication.go index 20ee76f8b5..fb29e8e170 100644 --- a/azuread/helpers/graph/replication.go +++ b/azuread/helpers/graph/replication.go @@ -6,6 +6,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/hashicorp/terraform/helper/resource" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" ) diff --git a/azuread/resource_application.go b/azuread/resource_application.go index 4f2e45c13c..d0fd8c3d2a 100644 --- a/azuread/resource_application.go +++ b/azuread/resource_application.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p" diff --git a/azuread/resource_application_password.go b/azuread/resource_application_password.go index 7b3ca146b5..3bf0d9338f 100644 --- a/azuread/resource_application_password.go +++ b/azuread/resource_application_password.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf" diff --git a/azuread/resource_application_password_test.go b/azuread/resource_application_password_test.go index 405e575bad..e034681532 100644 --- a/azuread/resource_application_password_test.go +++ b/azuread/resource_application_password_test.go @@ -44,7 +44,7 @@ func testCheckADApplicationPasswordExists(name string) resource.TestCheckFunc { return nil } - return fmt.Errorf("Password Credential %q was not found in Aplication %q", id.KeyId, id.ObjectId) + return fmt.Errorf("Password Credential %q was not found in Application %q", id.KeyId, id.ObjectId) } } diff --git a/azuread/resource_application_test.go b/azuread/resource_application_test.go index 8a992164e4..6edf137309 100644 --- a/azuread/resource_application_test.go +++ b/azuread/resource_application_test.go @@ -8,6 +8,7 @@ import ( "github.com/google/uuid" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" ) diff --git a/azuread/resource_group.go b/azuread/resource_group.go index 66ff3d6794..82c686d3fb 100644 --- a/azuread/resource_group.go +++ b/azuread/resource_group.go @@ -8,6 +8,7 @@ import ( "github.com/google/uuid" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p" @@ -48,7 +49,7 @@ func resourceGroupCreate(d *schema.ResourceData, meta interface{}) error { properties := graphrbac.GroupCreateParameters{ DisplayName: &name, MailEnabled: p.Bool(false), // we're defaulting to false, as the API currently only supports the creation of non-mail enabled security groups. - MailNickname: p.String(uuid.New().String()), // this matches the portal behavior + MailNickname: p.String(uuid.New().String()), // this matches the portal behaviour SecurityEnabled: p.Bool(true), // we're defaulting to true, as the API currently only supports the creation of non-mail enabled security groups. } diff --git a/azuread/resource_group_test.go b/azuread/resource_group_test.go index e210c2e666..75e923e514 100644 --- a/azuread/resource_group_test.go +++ b/azuread/resource_group_test.go @@ -7,6 +7,7 @@ import ( "github.com/hashicorp/go-uuid" "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" ) diff --git a/azuread/resource_service_principal.go b/azuread/resource_service_principal.go index 35cbaf3f36..b3cd008fb8 100644 --- a/azuread/resource_service_principal.go +++ b/azuread/resource_service_principal.go @@ -4,17 +4,15 @@ import ( "fmt" "log" - "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" - "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf" - - "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate" - + "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/go-azure-helpers/response" + "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p" - - "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" - "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/validate" ) const servicePrincipalResourceName = "azuread_service_principal" @@ -88,7 +86,7 @@ func resourceServicePrincipalCreate(d *schema.ResourceData, meta interface{}) er return client.Get(ctx, *sp.ObjectID) }) if err != nil { - return fmt.Errorf("Error waiting for Service Pricipal with ObjectId %q: %+v", *sp.ObjectID, err) + return fmt.Errorf("Error waiting for Service Principal with ObjectId %q: %+v", *sp.ObjectID, err) } return resourceServicePrincipalRead(d, meta) diff --git a/azuread/resource_service_principal_password.go b/azuread/resource_service_principal_password.go index b52b8238e2..c94a918d99 100644 --- a/azuread/resource_service_principal_password.go +++ b/azuread/resource_service_principal_password.go @@ -7,6 +7,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/terraform/helper/schema" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/tf" diff --git a/azuread/resource_user.go b/azuread/resource_user.go index d38b2ade9f..d7d60a01fa 100644 --- a/azuread/resource_user.go +++ b/azuread/resource_user.go @@ -8,6 +8,7 @@ import ( "github.com/Azure/azure-sdk-for-go/services/graphrbac/1.6/graphrbac" "github.com/hashicorp/terraform/helper/schema" "github.com/hashicorp/terraform/helper/validation" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/graph" "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/p" diff --git a/azuread/resource_user_test.go b/azuread/resource_user_test.go index f26ec2ff0a..6f520a2a29 100644 --- a/azuread/resource_user_test.go +++ b/azuread/resource_user_test.go @@ -8,6 +8,7 @@ import ( "github.com/hashicorp/terraform/helper/resource" "github.com/hashicorp/terraform/terraform" + "github.com/terraform-providers/terraform-provider-azuread/azuread/helpers/ar" ) diff --git a/examples/service_principal/basic/main.tf b/examples/service_principal/basic/main.tf index 17037e0c8a..10468a7b3b 100644 --- a/examples/service_principal/basic/main.tf +++ b/examples/service_principal/basic/main.tf @@ -1,5 +1,5 @@ ## This example creates a basic application and Service Principal using the Azure Active Directory resources. -# WARNING: the service pricipal password will be presisted to state +# WARNING: the service Principal password will be presisted to state #create a random identifier for the application name resource "random_id" "app_name" { diff --git a/examples/service_principal/create-for-rbac/main.tf b/examples/service_principal/create-for-rbac/main.tf index 236e19b806..d54425598e 100644 --- a/examples/service_principal/create-for-rbac/main.tf +++ b/examples/service_principal/create-for-rbac/main.tf @@ -1,7 +1,7 @@ ## This example creates a basic application and Service Principal and then assigns a role ## this mimics the behaviour of `az ad sp create-for-rbac --years 2` -# WARNING: the service pricipal password will be presisted to state +# WARNING: the service principal password will be presisted to state data "azurerm_subscription" "main" {} diff --git a/website/docs/auth/service_principal_configuration.html.markdown b/website/docs/auth/service_principal_configuration.html.markdown index 7a0431a229..cc875f3fbf 100644 --- a/website/docs/auth/service_principal_configuration.html.markdown +++ b/website/docs/auth/service_principal_configuration.html.markdown @@ -92,7 +92,7 @@ if ($role -eq $null) { $role = Get-AzureADDirectoryRole | Where-Object {$_.displayName -eq 'Company Administrator'} } -$sp = Get-AzureADServicePrincipal | Where-Object {$_.displayName -eq 'Service Pricipal Name'} +$sp = Get-AzureADServicePrincipal | Where-Object {$_.displayName -eq 'Service Principal Name'} $sp.ObjectId Add-AzureADDirectoryRoleMember -ObjectId $role.ObjectId -RefObjectId $sp.ObjectId