@@ -700,6 +700,31 @@ func TestAccGenericResource_moveStorageContainer(t *testing.T) {
700700 })
701701}
702702
703+ func TestAccGenericResource_moveStorageShare (t * testing.T ) {
704+ data := acceptance .BuildTestData (t , "azapi_resource" , "test" )
705+ r := GenericResource {}
706+ data .ResourceTest (t , r , []resource.TestStep {
707+ {
708+ Config : r .moveStorageShareSetup (data ),
709+ ExternalProviders : externalProvidersAzurerm (),
710+ },
711+ {
712+ Config : r .moveStorageShareStartMoving (data ),
713+ Check : resource .ComposeTestCheckFunc (
714+ check .That (data .ResourceName ).ExistsInAzure (r ),
715+ ),
716+ ExternalProviders : externalProvidersAzurerm (),
717+ },
718+ {
719+ Config : r .moveStorageShareUpdate (data ),
720+ Check : resource .ComposeTestCheckFunc (
721+ check .That (data .ResourceName ).ExistsInAzure (r ),
722+ ),
723+ ExternalProviders : externalProvidersAzurerm (),
724+ },
725+ })
726+ }
727+
703728func TestAccGenericResource_moveKeyVaultSecret (t * testing.T ) {
704729 data := acceptance .BuildTestData (t , "azapi_resource" , "test" )
705730 r := GenericResource {}
@@ -2749,6 +2774,128 @@ resource "azapi_resource" "test" {
27492774` , r .template (data ), data .RandomString )
27502775}
27512776
2777+ func (r GenericResource ) moveStorageShareSetup (data acceptance.TestData ) string {
2778+ return fmt .Sprintf (`
2779+ %s
2780+
2781+ provider "azurerm" {
2782+ features {}
2783+ }
2784+
2785+ resource "azurerm_storage_account" "sa" {
2786+ name = "acctestsa%[2]s"
2787+ location = azapi_resource.resourceGroup.location
2788+ resource_group_name = azapi_resource.resourceGroup.name
2789+ account_tier = "Standard"
2790+ account_replication_type = "LRS"
2791+ }
2792+
2793+ resource "azurerm_storage_share" "share" {
2794+ name = "acctestshare%[2]s"
2795+ storage_account_name = azurerm_storage_account.sa.name
2796+ quota = 50
2797+ }
2798+ ` , r .template (data ), data .RandomString )
2799+ }
2800+
2801+ func (r GenericResource ) moveStorageShareStartMoving (data acceptance.TestData ) string {
2802+ return fmt .Sprintf (`
2803+ %s
2804+
2805+ provider "azurerm" {
2806+ features {}
2807+ }
2808+
2809+ moved {
2810+ from = azurerm_storage_share.share
2811+ to = azapi_resource.test
2812+ }
2813+
2814+ resource "azurerm_storage_account" "sa" {
2815+ name = "acctestsa%[2]s"
2816+ location = azapi_resource.resourceGroup.location
2817+ resource_group_name = azapi_resource.resourceGroup.name
2818+ account_tier = "Standard"
2819+ account_replication_type = "LRS"
2820+ }
2821+
2822+ //resource "azurerm_storage_share" "share" {
2823+ // name = "acctestshare%[2]s"
2824+ // storage_account_name = azurerm_storage_account.sa.name
2825+ // quota = 50
2826+ //}
2827+
2828+ data "azapi_resource_id" "fileService" {
2829+ type = "Microsoft.Storage/storageAccounts/fileServices@2023-05-01"
2830+ parent_id = azurerm_storage_account.sa.id
2831+ name = "default"
2832+ }
2833+
2834+ resource "azapi_resource" "test" {
2835+ type = "Microsoft.Storage/storageAccounts/fileServices/shares@2023-05-01"
2836+ parent_id = data.azapi_resource_id.fileService.id
2837+ name = "acctestshare%[2]s"
2838+ body = {
2839+ properties = {
2840+ shareQuota = 50
2841+ }
2842+ }
2843+ ignore_casing = false
2844+ schema_validation_enabled = true
2845+ ignore_missing_property = true
2846+ }
2847+ ` , r .template (data ), data .RandomString )
2848+ }
2849+
2850+ func (r GenericResource ) moveStorageShareUpdate (data acceptance.TestData ) string {
2851+ return fmt .Sprintf (`
2852+ %s
2853+
2854+ provider "azurerm" {
2855+ features {}
2856+ }
2857+
2858+ moved {
2859+ from = azurerm_storage_share.share
2860+ to = azapi_resource.test
2861+ }
2862+
2863+ resource "azurerm_storage_account" "sa" {
2864+ name = "acctestsa%[2]s"
2865+ location = azapi_resource.resourceGroup.location
2866+ resource_group_name = azapi_resource.resourceGroup.name
2867+ account_tier = "Standard"
2868+ account_replication_type = "LRS"
2869+ }
2870+
2871+ //resource "azurerm_storage_share" "share" {
2872+ // name = "acctestshare%[2]s"
2873+ // storage_account_name = azurerm_storage_account.sa.name
2874+ // quota = 50
2875+ //}
2876+
2877+ data "azapi_resource_id" "fileService" {
2878+ type = "Microsoft.Storage/storageAccounts/fileServices@2023-05-01"
2879+ parent_id = azurerm_storage_account.sa.id
2880+ name = "default"
2881+ }
2882+
2883+ resource "azapi_resource" "test" {
2884+ type = "Microsoft.Storage/storageAccounts/fileServices/shares@2023-05-01"
2885+ parent_id = data.azapi_resource_id.fileService.id
2886+ name = "acctestshare%[2]s"
2887+ body = {
2888+ properties = {
2889+ shareQuota = 100
2890+ }
2891+ }
2892+ ignore_casing = false
2893+ schema_validation_enabled = true
2894+ ignore_missing_property = true
2895+ }
2896+ ` , r .template (data ), data .RandomString )
2897+ }
2898+
27522899func (r GenericResource ) moveKeyVaultSecretSetup (data acceptance.TestData ) string {
27532900 return fmt .Sprintf (`
27542901%s
0 commit comments