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_linux_function_app returns empty string from default_hostname #16263

Closed
1 task done
alex-zyl opened this issue Apr 5, 2022 · 17 comments
Closed
1 task done

azurerm_linux_function_app returns empty string from default_hostname #16263

alex-zyl opened this issue Apr 5, 2022 · 17 comments

Comments

@alex-zyl
Copy link

alex-zyl commented Apr 5, 2022

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

Terraform Version

1.1.7

AzureRM Provider Version

3.0.2

Affected Resource(s)/Data Source(s)

azurerm_linux_function_app

Terraform Configuration Files

provider "azurerm" {
  features {  }
}

data "azurerm_client_config" "current" {}

locals {
  function_name = "azfuncbugtest"
  rg_name       = "azfuncbugrg"
  location      = "eastus"
}

resource "azurerm_resource_group" "function" {
  name     = "azfuncbugrg"
  location = "eastus"
}

resource "azurerm_service_plan" "function" {
  name                = "${local.function_name}-plan"
  resource_group_name = azurerm_resource_group.function.name
  location            = azurerm_resource_group.function.location
  os_type             = "Linux"
  sku_name            = "Y1"
}

resource "azurerm_storage_account" "function" {
  name                     = "${local.function_name}stor"
  resource_group_name      = azurerm_resource_group.function.name
  location                 = azurerm_resource_group.function.location
  account_tier             = "Standard"
  account_replication_type = "LRS"
}

resource "azurerm_linux_function_app" "function" {
  name                        = "${local.function_name}-function"
  resource_group_name         = azurerm_resource_group.function.name
  location                    = azurerm_resource_group.function.location
  service_plan_id             = azurerm_service_plan.function.id
  storage_account_name        = azurerm_storage_account.function.name
  storage_account_access_key  = azurerm_storage_account.function.primary_access_key
  functions_extension_version = "~3"

  app_settings = {
    "FUNCTIONS_WORKER_RUNTIME"                 = "dotnet"
  }

  site_config {}
}

output "Function" {
  # showing only selected properties to skip sensitive data
  value = {
    function_url = azurerm_linux_function_app.function.default_hostname
  }
}

Debug Output/Panic Output

No panic

Expected Behaviour

The Linux azure function app should have default_hostname property set.

Actual Behaviour

default_hostname property value is empty

Steps to Reproduce

  1. terraform init
  2. terraform apply

Important Factoids

No response

References

Original report: #16176

@alex-zyl alex-zyl added the bug label Apr 5, 2022
@github-actions github-actions bot removed the bug label Apr 5, 2022
@jshield
Copy link

jshield commented Apr 6, 2022

just an addendum it's not just DefaultHostname quite a number of properties are missing.

@jdegiglio
Copy link

I've noticed the same behavior on the azurerm_windows_function_app resource and data objects, as well. I've just updated to version 1.1.8 and it's still a problem there.

As a workaround, I'm using the azurerm_function_app data object and retrieving the default_hostname for my function app from that.

@kousourakis
Copy link

Have the same issue on azurerm v3.3.0, terraform v1.19.0

@ZinkNotTheMetal
Copy link

I've noticed the same behavior on the azurerm_windows_function_app resource and data objects, as well. I've just updated to version 1.1.8 and it's still a problem there.

As a workaround, I'm using the azurerm_function_app data object and retrieving the default_hostname for my function app from that.

Can you share code on how you got the default_host name?

@erorubrz
Copy link

erorubrz commented May 4, 2022

I've noticed the same behavior on the azurerm_windows_function_app resource and data objects, as well. I've just updated to version 1.1.8 and it's still a problem there.

As a workaround, I'm using the azurerm_function_app data object and retrieving the default_hostname for my function app from that.

I just tried this and it works. That is confusing, but it's the best we got at the moment. Thanks for the tip! 👍

@jdegiglio
Copy link

I've noticed the same behavior on the azurerm_windows_function_app resource and data objects, as well. I've just updated to version 1.1.8 and it's still a problem there.
As a workaround, I'm using the azurerm_function_app data object and retrieving the default_hostname for my function app from that.

Can you share code on how you got the default_host name?

Here's a quick sample of how I'm using the azurerm_function_app data object to retrieve default_hostname:

resource "azurerm_windows_function_app" "your_windows_function_app" {
    all_your_properties_here = "values"
}

data "azurerm_function_app" "reference_to_your_windows_function_app" {
    name = azurerm_windows_function_app.your_windows_function_app.name
    resource_group_name = "your_resource_group_name_here"
}

# This will correctly return default_hostname, but Terraform will throw deprecation warnings (which is ok for now)
output "fa_url_deprecated" {
    value = data.azurerm_function_app.reference_to_your_windows_function_app.default_hostname
}

# This is the way we want to retrieve default_hostname when the new resources objects get fixed
output "fa_url" {
    value = azurerm_windows_function_app.your_windows_function_app.default_hostname
}

@ericfaure007

This comment was marked as off-topic.

@andrew-flatters-bliss
Copy link
Contributor

I Have the same issue on azurerm v3.6.0.

@ericfaure007 Think they prefer us to 👍 the original rather than putting comments in if we've reproduced it.

@Romiko

This comment was marked as off-topic.

@pacorreia

This comment was marked as off-topic.

@eprokofev

This comment was marked as off-topic.

@SteveKurutz

This comment was marked as off-topic.

@pacorreia

This comment was marked as off-topic.

@jeramec

This comment was marked as off-topic.

@xiaxyi
Copy link
Contributor

xiaxyi commented Jul 5, 2022

Thanks guys for pointing out this issue, please track the fix in the mentioned pr

@github-actions
Copy link

This functionality has been released in v3.14.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests