diff --git a/internal/services/compute/shared_image_gallery_resource_test.go b/internal/services/compute/shared_image_gallery_resource_test.go index cffe34afd529..9dc421493781 100644 --- a/internal/services/compute/shared_image_gallery_resource_test.go +++ b/internal/services/compute/shared_image_gallery_resource_test.go @@ -126,6 +126,21 @@ func TestAccSharedImageGallery_groupsGallery(t *testing.T) { }) } +func TestAccSharedImageGallery_privateGallery(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_shared_image_gallery", "test") + r := SharedImageGalleryResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.privateGallery(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + func (t SharedImageGalleryResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { id, err := galleries.ParseGalleryID(state.ID) if err != nil { @@ -251,3 +266,26 @@ resource "azurerm_shared_image_gallery" "test" { } `, data.RandomInteger, data.Locations.Primary, data.RandomInteger) } + +func (SharedImageGalleryResource) privateGallery(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%d" + location = "%s" +} + +resource "azurerm_shared_image_gallery" "test" { + name = "acctestsig%d" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location + + sharing { + permission = "Private" + } +} +`, data.RandomInteger, data.Locations.Primary, data.RandomInteger) +}