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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Azure Function App's health_check_eviction_time_in_min (in site_config) gets reset from 0 to 2 by terraform if health check isn't enabled #25738

Open
1 task done
vsablrin opened this issue Apr 24, 2024 · 2 comments

Comments

@vsablrin
Copy link

vsablrin commented Apr 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.6.6

AzureRM Provider Version

3.70.0

Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Terraform Configuration Files

Any config that allows creation of a linux function app.

Debug Output/Panic Output

After this function-app resource is created, subsequent terraform plans always shows this below change, which never gets fixed by a terraform apply.

  module.funcs["datagroup"].azurerm_linux_function_app.main["instance"] will be updated in-place
  ~ resource "azurerm_linux_function_app" "main" {
        id                                = "/subscriptions/............"
        name                              = "func-app-xyz"
      ~ tags                              = {
            "category"                                       = "ABC"
        }

      ~ site_config {
          ~ health_check_eviction_time_in_min       = 0 -> 2
            # (25 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }

        # (1 unchanged block hidden)
    }

Expected Behaviour

There should be no change to health_check_eviction_time_in_min planned by terraform.

Actual Behaviour

When health_check is disabled (i.e., not enabled) for a Function App (verify in portal), then the function app's health_check_eviction_time_in_min will be set to 0 by Azure. But the terraform provider wrongly tries to set it to the lowest possible non-zero value, which is 2. This leads to a lingering change in the plan, which cannot be effectively/permanently applied. When this is applied, Azure would change the eviction time back to 0 since health_check is disabled for the function-app. Terraform provider wants to change this 0 to 2 in subsequent terraform-plans. This planned output is displayed even when no change is made to the configuration (code files).

module.funcs["datagroup"].azurerm_linux_function_app.main["instance"] will be updated in-place

~ resource "azurerm_linux_function_app" "main" {
id = "/subscriptions/............"
name = "func-app-xyz"
~ tags = {
"category" = "ABC"
}

  ~ site_config {
      ~ health_check_eviction_time_in_min       = 0 -> 2
        # (25 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

    # (1 unchanged block hidden)
}

Steps to Reproduce

  1. Create a function app in terraform.
  2. Run a terraform plan, and it will show a planned change to the health_check_eviction_time_in_min in the site_config section.
  3. Terraform apply will not make this change permanent,

Important Factoids

No response

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_function_app

@xiaxyi
Copy link
Contributor

xiaxyi commented Apr 25, 2024

Thanks @vsablrin for raising this issue, as mentioned in our official guidance, the property health_check_eviction_time_in_min needs to be used together with health_check_path.
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_function_app#health_check_eviction_time_in_min

@vsablrin
Copy link
Author

vsablrin commented Apr 25, 2024

Thanks @xiaxyi.
We don't specify set either health_check_eviction_time_in_min or health_check_path when creating the function app. The portal shows that health check is "disabled" for this function app. For disabled health checks, Azure sets the eviction time to 0 minutes, but terraform tries to change that to 2 minutes. The range of 2 to 10 minutes is valid only if the health check is enabled, as can be seen on the portal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants