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

azurerm_storage_data_lake_gen2_filesystem - allow $superuser to be set for group and owner #16215

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ func resourceStorageDataLakeGen2FileSystem() *pluginsdk.Resource {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.IsUUID,
ValidateFunc: validation.Any(validation.IsUUID, validation.StringInSlice([]string{"$superuser"}, false)),
},

"group": {
Type: pluginsdk.TypeString,
Optional: true,
Computed: true,
ValidateFunc: validation.IsUUID,
ValidateFunc: validation.Any(validation.IsUUID, validation.StringInSlice([]string{"$superuser"}, false)),
},

"ace": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,21 @@ func TestAccStorageDataLakeGen2FileSystem_withOwnerGroup(t *testing.T) {
})
}

func TestAccStorageDataLakeGen2FileSystem_withSuperUsers(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_storage_data_lake_gen2_filesystem", "test")
r := StorageDataLakeGen2FileSystemResource{}

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.withSuperUsers(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

func (r StorageDataLakeGen2FileSystemResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := filesystems.ParseResourceID(state.ID)
if err != nil {
Expand Down Expand Up @@ -340,3 +355,27 @@ resource "azurerm_storage_data_lake_gen2_filesystem" "test" {
}
`, template, data.RandomInteger)
}

func (r StorageDataLakeGen2FileSystemResource) withSuperUsers(data acceptance.TestData) string {
template := r.template(data)
return fmt.Sprintf(`
%s

provider "azuread" {}

resource "azuread_application" "test" {
display_name = "acctestspa%[2]d"
}

resource "azuread_service_principal" "test" {
application_id = azuread_application.test.application_id
}

resource "azurerm_storage_data_lake_gen2_filesystem" "test" {
name = "acctest-%[2]d"
storage_account_id = azurerm_storage_account.test.id
owner = "$superuser"
group = "$superuser"
}
`, template, data.RandomInteger)
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ The following arguments are supported:

* `ace` - (Optional) One or more `ace` blocks as defined below to specify the entries for the ACL for the path.

* `owner` - (Optional) Specifies the Object ID of the Azure Active Directory User to make the owning user of the root path (i.e. `/`).
* `owner` - (Optional) Specifies the Object ID of the Azure Active Directory User to make the owning user of the root path (i.e. `/`). Possible values also include `$superuser`.

* `group` - (Optional) Specifies the Object ID of the Azure Active Directory Group to make the owning group of the root path (i.e. `/`).
* `group` - (Optional) Specifies the Object ID of the Azure Active Directory Group to make the owning group of the root path (i.e. `/`). Possible values also include `$superuser`.

~> **NOTE:** The Storage Account requires `account_kind` to be either `StorageV2` or `BlobStorage`. In addition, `is_hns_enabled` has to be set to `true`.

Expand Down