azure-dev icon indicating copy to clipboard operation
azure-dev copied to clipboard

[Issue] Convert azd templates to use AVM instead of infra/core

Open jongio opened this issue 1 year ago • 7 comments

This is an effort to move all of our templates to use AVM instead of our own infra/core. More info on avm can be found here: https://aka.ms/avm

We are tracking individual modules needed for azd here: https://github.com/Azure/Azure-Verified-Modules/issues/261

All AVM modules needed for AZD: https://github.com/Azure/Azure-Verified-Modules/labels/AZD%20%3Atechnologist%3A

jongio avatar Feb 09 '24 20:02 jongio

Are you still thinking of doing this? We are making various improvements to the Bicep modules we use, and it would be good to know where to put our efforts.

pamelafox avatar May 08 '24 00:05 pamelafox

@pamelafox - Yes, but AVM isn't quite ready to move to yet. There are some missing features. We are tracking it internally. LMK if you want to see it.

jongio avatar May 08 '24 22:05 jongio

@jongio just to make it clear for myself, say I were to make a new internal AZD template for my team would I be able to make use of the AVM instead of the infra/core modules? The modules my team would need are currently available in AVM or are the missing features you mentioned of a different nature.

MennoDeee avatar May 15 '24 08:05 MennoDeee

@jongio just to make it clear for myself, say I were to make a new internal AZD template for my team would I be able to make use of the AVM instead of the infra/core modules? The modules my team would need are currently available in AVM or are the missing features you mentioned of a different nature.

You can use avm to build azd templates if they meet your template needs.

We have a project to move all official-ms azd templates to avm, but avm is missing features that is preventing us from moving all our templates.

jongio avatar May 17 '24 13:05 jongio

I'm using AVM and running into an issue with tagging.

https://github.com/Azure/terraform-azurerm-avm-res-web-site

The tags on the module are applied to all created resources, Storage Account, Service Plan, and Function App.

azd-service-name : <My Service Name> is applied to all resources and az deploy can't distinguish the resources.

Where does the solution lie?

  • azd being able to distinguish resource by azd-service-name + host value in azure.yaml
  • OR AVM modifying how tags are applied to resources.

I think I can get around it for now with a postprovision hook to add missing tags to my target function apps.

eamreyes avatar Aug 19 '24 23:08 eamreyes

@v-xuto Can you please have a look at @eamreyes issue?

jongio avatar Aug 20 '24 16:08 jongio

@eamreyes You can use this function app example: https://registry.terraform.io/modules/Azure/avm-res-web-site/azurerm/latest/examples/function_app to create a Function App. Add tags: azd-service-name : <My Service Name> to the module "test", and the Storage Account and Service Plan will be created separately. In this case, the tags will not be applied to Storage Account and Service Plan. You can try this method.

Menghua1 avatar Aug 21 '24 07:08 Menghua1

I'm using AVM for about 9 Azure Cosmos DB AZD templates. Some use Entra auth end-to-end and one uses Azure Key Vault. It's come a long way since earlier this year.

  • https://github.com/azure-samples/cosmos-db-nosql-dotnet-quickstart
  • https://github.com/azure-samples/cosmos-db-nosql-python-quickstart
  • https://github.com/azure-samples/cosmos-db-nosql-nodejs-quickstart
  • https://github.com/azure-samples/cosmos-db-nosql-java-quickstart
  • https://github.com/azure-samples/cosmos-db-nosql-go-quickstart
  • https://github.com/azure-samples/cosmos-db-table-dotnet-quickstart
  • https://github.com/azure-samples/cosmos-db-table-python-quickstart
  • https://github.com/azure-samples/cosmos-db-table-nodejs-quickstart
  • https://github.com/azure-samples/cosmos-db-table-go-quickstart

The huge advantage is that I get to have all of the goodness of AZD, deploy to a resource group, and keep a really slim single main.bicep file that other people can understand quickly. I understand that philosophically this is different than your templates.

I completely understand that it doesn't cover all of your needs yet, but I did want to share an example of how much simpler it makes the main.bicep file when it's available.

seesharprun avatar Nov 07 '24 23:11 seesharprun