Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_windows_function_app, azurerm_linux_function_app - adding property website_content_share_over_vnet #26646

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

xiaxyi
Copy link
Contributor

@xiaxyi xiaxyi commented Jul 16, 2024

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here
    azurerm_windows_function_app, azurerm_linux_function_app - adding property website_content_over_vnet

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevent documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)

--- PASS: TestAccWindowsFunctionApp_websiteContentOverVnetUpdate (585.08s)
PASS
ok github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice 603.626s
--- PASS: TestAccLinuxFunctionApp_websiteContentOverVnetUpdate (643.45s)
PASS
ok github.com/hashicorp/terraform-provider-azurerm/internal/services/appservice 648.859s

Change Log

Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.

  • azurerm_windows_function_app, azurerm_linux_function_app - adding property website_content_over_vnet

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

Note

If this PR changes meaningfully during the course of review please update the title and description as required.

Copy link
Member

@jackofallops jackofallops left a comment

Choose a reason for hiding this comment

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

Thanks @xiaxyi - Some comments and changes to take a look at below. I think this needs a little re-work, particularly around the tests as both configurable options there are being used for this setting, so it's inconclusive if the new property is behaving / work as expected and will mask any conflicting behaviours with the older app_setting mechanism of enabling this behaviour?
Can you take a look, and I'll continue review.

Thanks!

@@ -70,6 +70,7 @@ type LinuxFunctionAppModel struct {
PublishingDeployBasicAuthEnabled bool `tfschema:"webdeploy_publish_basic_authentication_enabled"`
PublishingFTPBasicAuthEnabled bool `tfschema:"ftp_publish_basic_authentication_enabled"`
Identity []identity.ModelSystemAssignedUserAssigned `tfschema:"identity"`
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"`
Copy link
Member

Choose a reason for hiding this comment

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

Following contributor guidelines, this should be:

Suggested change
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"`
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet_enabled"`

Comment on lines 309 to 314
"website_content_over_vnet": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.",
},
Copy link
Member

Choose a reason for hiding this comment

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

As above, this should be website_content_over_vnet_enabled.

I also think the Description here needs re-wording, I'm not sure I understand what this has to do with app scale?

Comment on lines 1883 to 1889
app_settings = {
WEBSITE_CONTENTOVERVNET = "%s"
WEBSITE_CONTENTSHARE = "shareforfa"
}

site_config {}
website_content_over_vnet = %t
Copy link
Member

Choose a reason for hiding this comment

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

We should not be setting both of these? If we're promoting this to be a top level attribute we should be excluding it's use in the app_settings map and managing that on the user's behalf as with the other examples of this behaviour.

@@ -69,6 +69,7 @@ type WindowsFunctionAppModel struct {
ZipDeployFile string `tfschema:"zip_deploy_file"`
PublishingDeployBasicAuthEnabled bool `tfschema:"webdeploy_publish_basic_authentication_enabled"`
PublishingFTPBasicAuthEnabled bool `tfschema:"ftp_publish_basic_authentication_enabled"`
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"`
Copy link
Member

Choose a reason for hiding this comment

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

as above:

Suggested change
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet"`
VnetContentShareEnabled bool `tfschema:"website_content_over_vnet_enabled"`

Comment on lines 308 to 313
"website_content_over_vnet": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.",
},
Copy link
Member

Choose a reason for hiding this comment

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

as above:

Suggested change
"website_content_over_vnet": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.",
},
"website_content_over_vnet_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: false,
Description: "Should the app scale enabled when storage account restricted to a virtual network? Defaults to `false`.",
},

Similarly, can you review the description here, it doesn't make sense to me?

_, contentSharePresent := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]
if _, contentShareConnectionStringPresent := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !contentShareConnectionStringPresent {
functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString
}

if !contentSharePresent {
if contentOverVnetEnabled {
if contentOverVnetEnabled || contentOverVnetEnabledSiteSetting {
return fmt.Errorf("the app_setting WEBSITE_CONTENTSHARE must be specified and set to a valid share when WEBSITE_CONTENTOVERVNET is specified")
Copy link
Member

Choose a reason for hiding this comment

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

This error message needs additional clarification as there will be 2 ways this value can be true?

_, contentSharePresent := functionApp.AppSettings["WEBSITE_CONTENTSHARE"]
if _, contentShareConnectionStringPresent := functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"]; !contentShareConnectionStringPresent {
functionApp.AppSettings["WEBSITE_CONTENTAZUREFILECONNECTIONSTRING"] = storageString
}

if !contentSharePresent {
if contentOverVnetEnabled {
if contentOverVnetEnabled || contentOverVnetEnabledSiteSetting {
return fmt.Errorf("the app_setting WEBSITE_CONTENTSHARE must be specified and set to a valid share when WEBSITE_CONTENTOVERVNET is specified")
Copy link
Member

Choose a reason for hiding this comment

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

As above, this needs to be clear about the property, not just the app_setting value.

Comment on lines 118 to 120
* `website_content_over_vnet` - Is function app scale enabled when the linked storage account is restricted to a virtual network? Defaults to `false`.

!> **Note:** This property will replace the `WEBSITE_CONTENTOVERVNET` in `app_setting`. `website_content_over_vnet` is the recommended one despite both settings work currently.
Copy link
Member

Choose a reason for hiding this comment

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

This description doesn't sound like it matches what the setting does, it doesn't relate to app scale, rather if the storage account is accessed via VNet?

Copy link

This PR is being labeled as "stale" because it has not been updated for 30 or more days.

If this PR is still valid, please remove the "stale" label. If this PR is blocked, please add it to the "Blocked" milestone.

If you need some help completing this PR, please leave a comment letting us know. Thank you!

@xiaxyi xiaxyi requested review from katbyte and a team as code owners November 13, 2024 10:36
@xiaxyi xiaxyi changed the title azurerm_windows_function_app, azurerm_linux_function_app - adding property website_content_over_vnet azurerm_windows_function_app, azurerm_linux_function_app - adding property website_content_share_over_vnet Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants