Skip to content

Commit

Permalink
azurerm_logic_app_standard - support vnet_content_share_enabled (#…
Browse files Browse the repository at this point in the history
…28879)

* `azurerm_logic_app_standard` - add `vnet_content_share_enabled`

* update test case

* typo

* update test case

* update per comment
  • Loading branch information
ziyeqf authored Feb 27, 2025
1 parent f5bc6cb commit 9239ae1
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 6 deletions.
23 changes: 17 additions & 6 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@ func resourceLogicAppStandard() *pluginsdk.Resource {
Default: "~4",
},

"vnet_content_share_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
},

"virtual_network_subnet_id": {
Type: pluginsdk.TypeString,
Optional: true,
Expand Down Expand Up @@ -344,12 +349,13 @@ func resourceLogicAppStandardCreate(d *pluginsdk.ResourceData, meta interface{})
Location: location.Normalize(d.Get("location").(string)),
Tags: tags.Expand(d.Get("tags").(map[string]interface{})),
Properties: &webapps.SiteProperties{
ServerFarmId: pointer.To(d.Get("app_service_plan_id").(string)),
Enabled: pointer.To(d.Get("enabled").(bool)),
ClientAffinityEnabled: pointer.To(d.Get("client_affinity_enabled").(bool)),
ClientCertEnabled: pointer.To(clientCertEnabled),
HTTPSOnly: pointer.To(d.Get("https_only").(bool)),
SiteConfig: &siteConfig,
ServerFarmId: pointer.To(d.Get("app_service_plan_id").(string)),
Enabled: pointer.To(d.Get("enabled").(bool)),
ClientAffinityEnabled: pointer.To(d.Get("client_affinity_enabled").(bool)),
ClientCertEnabled: pointer.To(clientCertEnabled),
HTTPSOnly: pointer.To(d.Get("https_only").(bool)),
SiteConfig: &siteConfig,
VnetContentShareEnabled: pointer.To(d.Get("vnet_content_share_enabled").(bool)),
},
}

Expand Down Expand Up @@ -495,6 +501,10 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{})
}
}

if d.HasChange("vnet_content_share_enabled") {
siteEnvelope.Properties.VnetContentShareEnabled = pointer.To(d.Get("vnet_content_share_enabled").(bool))
}

if !features.FivePointOh() { // Until 5.0 the site_config value of this must be reflected back into the top-level property if not set there
siteConfig.PublicNetworkAccess = pointer.To(reconcilePNA(d))
}
Expand Down Expand Up @@ -641,6 +651,7 @@ func resourceLogicAppStandardRead(d *pluginsdk.ResourceData, meta interface{}) e
d.Set("client_affinity_enabled", pointer.From(props.ClientAffinityEnabled))
d.Set("custom_domain_verification_id", pointer.From(props.CustomDomainVerificationId))
d.Set("virtual_network_subnet_id", pointer.From(props.VirtualNetworkSubnetId))
d.Set("vnet_content_share_enabled", pointer.From(props.VnetContentShareEnabled))
d.Set("public_network_access", pointer.From(props.PublicNetworkAccess))

clientCertMode := ""
Expand Down
50 changes: 50 additions & 0 deletions internal/services/logic/logic_app_standard_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1014,6 +1014,38 @@ func TestAccLogicAppStandard_publicNetworkAccessEnabled(t *testing.T) {
})
}

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

data.ResourceTest(t, r, []acceptance.TestStep{
{
Config: r.vnetContentShareEnabled(data, false),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("vnet_content_share_enabled").HasValue("false"),
),
},
data.ImportStep(),
{
Config: r.vnetContentShareEnabled(data, true),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("vnet_content_share_enabled").HasValue("true"),
),
},
data.ImportStep(),
{
Config: r.vnetContentShareEnabled(data, false),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("vnet_content_share_enabled").HasValue("false"),
),
},
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 @@ -2252,3 +2284,21 @@ resource "azurerm_logic_app_standard" "test" {
}
`, r.template(data), data.RandomInteger, enabled)
}

func (r LogicAppStandardResource) vnetContentShareEnabled(data acceptance.TestData, enabled bool) 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
vnet_content_share_enabled = %t
scm_publish_basic_authentication_enabled = false
ftp_publish_basic_authentication_enabled = false
}
`, r.template(data), data.RandomInteger, enabled)
}
2 changes: 2 additions & 0 deletions website/docs/r/logic_app_standard.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ The following arguments are supported:

~> **Note:** Assigning the `virtual_network_subnet_id` property requires [RBAC permissions on the subnet](https://docs.microsoft.com/en-us/azure/app-service/overview-vnet-integration#permissions)

* `vnet_content_share_enabled` - (Optional) Specifies whether allow routing traffic between the Logic App and Storage Account content share through a virtual network. Defaults to `false`.

* `tags` - (Optional) A mapping of tags to assign to the resource.

---
Expand Down

0 comments on commit 9239ae1

Please sign in to comment.