Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New resource: azurerm_storage_account_local_user #19592

Merged
merged 13 commits into from
Jan 12, 2023
10 changes: 10 additions & 0 deletions internal/acceptance/check/that.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ func (t thatWithKeyType) IsEmpty() pluginsdk.TestCheckFunc {
return resource.TestCheckResourceAttr(t.resourceName, t.key, "")
}

// IsNotEmpty returns a TestCheckFunc which validates that the specific key is not empty on the resource
func (t thatWithKeyType) IsNotEmpty() pluginsdk.TestCheckFunc {
return resource.TestCheckResourceAttrWith(t.resourceName, t.key, func(value string) error {
if value == "" {
return fmt.Errorf("value is empty")
}
return nil
})
}

// IsSet returns a TestCheckFunc which validates that the specific key is set on the resource
func (t thatWithKeyType) IsSet() pluginsdk.TestCheckFunc {
return resource.TestCheckResourceAttrSet(t.resourceName, t.key)
Expand Down
1 change: 1 addition & 0 deletions internal/provider/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration {
sentinel.Registration{},
serviceconnector.Registration{},
servicefabricmanaged.Registration{},
storage.Registration{},
orbital.Registration{},
streamanalytics.Registration{},
search.Registration{},
Expand Down
6 changes: 6 additions & 0 deletions internal/services/storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/Azure/go-autorest/autorest"
"github.com/Azure/go-autorest/autorest/azure"
storage_v2022_05_01 "github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01"
"github.com/hashicorp/go-azure-sdk/resource-manager/storage/2022-05-01/localusers"
"github.com/hashicorp/terraform-provider-azurerm/internal/common"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/storage/shim"
"github.com/tombuildsstuff/giovanni/storage/2019-12-12/blob/accounts"
Expand All @@ -26,6 +27,7 @@ import (

type Client struct {
AccountsClient *storage.AccountsClient
LocalUsersClient *localusers.LocalUsersClient
FileSystemsClient *filesystems.Client
ADLSGen2PathsClient *paths.Client
ManagementPoliciesClient *storage.ManagementPoliciesClient
Expand All @@ -49,6 +51,9 @@ func NewClient(options *common.ClientOptions) *Client {
accountsClient := storage.NewAccountsClientWithBaseURI(options.ResourceManagerEndpoint, options.SubscriptionId)
options.ConfigureClient(&accountsClient.Client, options.ResourceManagerAuthorizer)

localUsersClient := localusers.NewLocalUsersClientWithBaseURI(options.ResourceManagerEndpoint)
localUsersClient.Client.Authorizer = options.ResourceManagerAuthorizer

fileSystemsClient := filesystems.NewWithEnvironment(options.Environment)
options.ConfigureClient(&fileSystemsClient.Client, options.StorageAuthorizer)

Expand Down Expand Up @@ -88,6 +93,7 @@ func NewClient(options *common.ClientOptions) *Client {
// (which should fix #2977) when the storage clients have been moved in here
client := Client{
AccountsClient: &accountsClient,
LocalUsersClient: &localUsersClient,
FileSystemsClient: &fileSystemsClient,
ADLSGen2PathsClient: &adlsGen2PathsClient,
ManagementPoliciesClient: &managementPoliciesClient,
Expand Down
10 changes: 10 additions & 0 deletions internal/services/storage/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,13 @@ func (r Registration) SupportedResources() map[string]*pluginsdk.Resource {
"azurerm_storage_sync_group": resourceStorageSyncGroup(),
}
}

func (r Registration) DataSources() []sdk.DataSource {
return []sdk.DataSource{}
}

func (r Registration) Resources() []sdk.Resource {
return []sdk.Resource{
LocalUserResource{},
}
}
Loading