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.

Home Page:https://aka.ms/azd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

davidfowl opened this issue · comments

Follow up from #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).