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.46k stars 4.54k forks source link

Support for linking static_web_app to container_app #26350

Open michael-ball-ctct opened 2 weeks ago

michael-ball-ctct commented 2 weeks ago

Is there an existing issue for this?

Community Note

Description

Similar to https://github.com/hashicorp/terraform-provider-azurerm/issues/14319 (but notably different):

Thanks to https://github.com/hashicorp/terraform-provider-azurerm/pull/25331 we can now link function_apps to static_web_apps via Terraform, but remain unable to link container_apps in the same fashion without taking manual steps in the Azure Portal Web UI. A similar resource would be fantastic for this subtly different use case.

At this stage, I am personally not familiar enough with Terraform (and Terraform plugins, etc.) to implement this myself.

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

azurerm_static_web_app_container_app_registration

Potential Terraform Configuration

resource "azurerm_static_web_app_container_app_registration" "container-app-to-swa-link" {
  static_web_app_id = azurerm_static_web_app.swa.id
  container_app_id  = azurerm_container_app.container-app.id
}

References

https://github.com/hashicorp/terraform-provider-azurerm/issues/14319 https://github.com/hashicorp/terraform-provider-azurerm/pull/25331

nnstt1 commented 1 week ago

After looking at the documentation and API specifications, it seems that all services (API Management, App Service, Container Apps) that can be linked as API backends for Static Web Apps are created using a common API. Only "User Provided Function App" are created with a separate API.

I think we need to decide whether to create a dedicated resource for linking Container Apps (azurerm_static_web_app_container_app_registration) or a service for linking services other than Functions (e.g. azurerm_static_web_app_link_backend). Could someone share their opinion on this matter? Thanks!

SlyckLizzie commented 1 week ago

I would like to see something more generic like azurerm_static_web_app_link_backend

michael-ball-ctct commented 1 week ago

I'd be all for a more generalised resource, as long as it gets the job done. My inital request was simply based on the existing similar feature.

nnstt1 commented 1 week ago

Thanks for your feedback! If it's okay, I'd like to work on implementing azurerm_static_web_app_link_backend for this issue.