hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.6k stars 4.65k forks source link

Support for Function App keys #23592

Open smokedlinq opened 1 year ago

smokedlinq commented 1 year ago

Is there an existing issue for this?

Community Note

Description

Add support for the function, master, and system keys. This will let us update the key to keep them in sync across resources. Basing this off of AzureCLI az functionapp keys set command.

New or Affected Resource(s)/Data Source(s)

azurerm_function_app_host_keys, azurerm_function_app_slot_host_keys

Potential Terraform Configuration

resource "azurerm_function_app_host_keys" "this" {
  resource_group_name = var.azurerm_function_app.resource_group_name
  name = var.azurerm_function_app.name

  key {
    type  = "function"
    name  = "MyFunctionName"
    value = var.my_function_name_key
  }

  key {
    type  = "master"
    name  = "MyMasterKey"
    value = var.my_function_key
  }

  key {
    type  = "system"
    name  = "MySystemKey"  
    value = var.my_function_system_key
  }
}

# Real world use, for setting the Event Grid extension system key
resource "azurerm_function_app_host_keys" "this" {
  resource_group_name = var.azurerm_function_app.resource_group_name
  name                = var.azurerm_function_app.name

  key {
    type  = "system"
    name  = "eventgrid_extension"
    value = var.eventgrid_extension_key
  }
}

References

No response

rcskosir commented 1 year ago

@smokedlinq Thank you for taking the time to open this feature request!