Azure / azure-dev

A developer CLI that reduces the time it takes for you to get started on Azure. The Azure Developer CLI (azd) provides a set of developer-friendly commands that map to key stages in your workflow - code, build, deploy, monitor, repeat.
https://aka.ms/azd
MIT License
369 stars 166 forks source link

Make it possible to use endpoints to containers, projects or dockerfiles in bicep parameters #3838

Closed davidfowl closed 2 weeks ago

davidfowl commented 2 weeks ago

Follow up from https://github.com/Azure/azure-dev/pull/3820

var builder = DistributedApplication.CreateBuilder(args);

var p = builder.AddProject<Projects.WebApplication1>("webapplication1");

var az = builder.AddAzureStorage("storage")
                .WithParameter("z", () => p.GetEndpoint("http"))
                .RunAsEmulator().AddQueues("q1");

builder.Build().Run();

Results in

module storage 'storage/storage.module.bicep' = {
  name: 'storage'
  scope: rg
  params: {
    location: location
    principalId: resources.outputs.MANAGED_IDENTITY_PRINCIPAL_ID
    principalType: 'ServicePrincipal'
    z: 'http://webapplication1.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }
  }
}

Notice the go template syntax in the bicep. This should just use the bicep value instead of the go template (when in this context).