Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,11 @@ func (r LogicAppResource) Update() sdk.ResourceFunc {
existingSiteConfig := sc.Model.Properties
siteEnvelope.SiteConfig = existingSiteConfig

// The `AzureStorageAccounts` received does not contain `endpoint`, which is required in some cases.
// Since we currently do not support this property, we remove it from the payload.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically this is

Suggested change
// Since we currently do not support this property, we remove it from the payload.
// Since the rest API spects do not contain this property, we remove it from the payload.

// Tracked by https://github.com/Azure/azure-rest-api-specs/issues/40128
siteEnvelope.SiteConfig.AzureStorageAccounts = nil
Comment thread
ziyeqf marked this conversation as resolved.

appSettingsResp, err := client.ListApplicationSettings(ctx, *id)
if err != nil || appSettingsResp.Model == nil {
return fmt.Errorf("reading App Settings for Linux %s: %+v", id, err)
Expand Down
96 changes: 96 additions & 0 deletions internal/services/logic/logic_app_standard_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,28 @@ func TestAccLogicAppStandard_vnetContentShareEnabled(t *testing.T) {
})
}

func TestAccLogicAppStandard_fileShareMountUpdate(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_logic_app_standard", "test")
r := LogicAppStandardResource{}

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

func (r LogicAppStandardResource) Exists(ctx context.Context, clients *clients.Client, state *pluginsdk.InstanceState) (*bool, error) {
id, err := commonids.ParseLogicAppId(state.ID)
if err != nil {
Expand Down Expand Up @@ -2653,3 +2675,77 @@ resource "azurerm_logic_app_standard" "test" {
}
`, r.template(data), data.RandomInteger, enabled)
}

func (r LogicAppStandardResource) fileShareMount(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_logic_app_standard" "test" {
name = "acctest-%d-func"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
storage_account_name = azurerm_storage_account.test.name
storage_account_access_key = azurerm_storage_account.test.primary_access_key
}

resource "azapi_resource_action" "logicapp_storage_config" {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The acctest failed here because you haven't configured azapi provider block

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated, but tbh I'm a bit concerned invovling azapi provider in the test

type = "Microsoft.Web/sites/config@2022-09-01"
resource_id = "${azurerm_logic_app_standard.test.id}/config/azurestorageaccounts"
method = "PUT"

body = {
properties = {
FileSystem = {
type = "FileShare",
accountName = azurerm_storage_account.test.name,
shareName = "dummy-share",
accessKey = azurerm_storage_account.test.primary_access_key,
mountPath = "\\mounts\\FileSystem",
endpoint = azurerm_storage_account.test.primary_blob_endpoint,
protocol = "Smb"
}
}
}
}
`, r.template(data), data.RandomInteger)
}

func (r LogicAppStandardResource) fileShareMountUpdate(data acceptance.TestData) string {
return fmt.Sprintf(`
%s

resource "azurerm_logic_app_standard" "test" {
name = "acctest-%d-func"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
app_service_plan_id = azurerm_app_service_plan.test.id
storage_account_name = azurerm_storage_account.test.name
storage_account_access_key = azurerm_storage_account.test.primary_access_key

tags = {
"test" = "1"
}
}

resource "azapi_resource_action" "logicapp_storage_config" {
type = "Microsoft.Web/sites/config@2022-09-01"
resource_id = "${azurerm_logic_app_standard.test.id}/config/azurestorageaccounts"
method = "PUT"

body = {
properties = {
FileSystem = {
type = "FileShare",
accountName = azurerm_storage_account.test.name,
shareName = "dummy-share",
accessKey = azurerm_storage_account.test.primary_access_key,
mountPath = "\\mounts\\FileSystem",
endpoint = azurerm_storage_account.test.primary_blob_endpoint,
protocol = "Smb"
}
}
}
}
`, r.template(data), data.RandomInteger)
}
Loading