Need Help Structuring the Deployment of an azurerm_linux_web_app Resource with Terraform

Hello everyone,

I’m currently working on a project where I want to deploy an azurerm_linux_web_app resource with an authentication system. My goal is to structure the code in a cleaner and more maintainable way.

Context

I would like to know if it’s possible to first create part of the resource (basic elements like name, resource_group_name, etc.), then wait for other resources to retrieve this information to create their own resources. After these resources are created (e.g., azuread_application, azuread_application_identifier_uri, etc.), I want to finalize the deployment of azurerm_linux_web_app with the remaining variables like app_settings and auth_settings_v2.

Objective

Here are the steps I want to achieve:

  1. Create the basic elements of azurerm_linux_web_app (name, resource group, etc.).
  2. Use this information to create other necessary resources (azuread_application, azuread_application_identifier_uri, etc.).
  3. Finalize the deployment of azurerm_linux_web_app with the remaining parameters.

Question

Could you advise me on the best way to proceed with Terraform to achieve this goal?

Thank you in advance for your help.

Best regards,
Gauthier C.