Skip to content

Commit

Permalink
workaround dual setting problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jackofallops committed Jan 9, 2025
1 parent f1c5f20 commit e0c50a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/services/logic/logic_app_standard_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func resourceLogicAppStandardUpdate(d *pluginsdk.ResourceData, meta interface{})
return fmt.Errorf("updating %s: %+v", *id, err)
}

if d.HasChange("site_config") { // update siteConfig before appSettings in case the appSettings get covered by basicAppSettings
if d.HasChange("site_config") || (d.HasChange("public_network_access") && !features.FivePointOhBeta()) { // update siteConfig before appSettings in case the appSettings get covered by basicAppSettings
siteConfigResource := webapps.SiteConfigResource{
Properties: &siteConfig,
}
Expand Down Expand Up @@ -1367,9 +1367,9 @@ func expandLogicAppStandardSiteConfig(d *pluginsdk.ResourceData) (webapps.SiteCo
}

if !features.FivePointOhBeta() {
if v, ok := config["public_network_access_enabled"]; ok {
if v, ok := config["public_network_access_enabled"]; ok || d.Get("public_network_access").(string) != "" {
pna := helpers.PublicNetworkAccessEnabled
if !v.(bool) {
if !v.(bool) || d.Get("public_network_access").(string) == helpers.PublicNetworkAccessDisabled {
pna = helpers.PublicNetworkAccessDisabled
}
siteConfig.PublicNetworkAccess = pointer.To(pna)
Expand Down
13 changes: 13 additions & 0 deletions internal/services/logic/logic_app_standard_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,26 @@ func TestAccLogicAppStandard_publicNetworkAccessDisabled(t *testing.T) {
Config: r.publicNetworkAccess(data, "Disabled"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("public_network_access").HasValue("Disabled"),
check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("false"),
),
},
data.ImportStep(),
{
Config: r.publicNetworkAccess(data, "Enabled"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("public_network_access").HasValue("Enabled"),
check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("true"),
),
},
data.ImportStep(),
{
Config: r.publicNetworkAccess(data, "Disabled"),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
check.That(data.ResourceName).Key("public_network_access").HasValue("Disabled"),
check.That(data.ResourceName).Key("site_config.0.public_network_access_enabled").HasValue("false"),
),
},
data.ImportStep(),
Expand Down

0 comments on commit e0c50a8

Please sign in to comment.