You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is under proposal, and has not yet been committed into plans.
This issue may require additional design around the "object model" of resources since it introduces concepts like ${event-hubs-prod.name}. The design around the object model would be a separate scoped item. This object model may also be required as AVM modules also expose intermediate types that are not the underlying ARM types.
Explicit mapping
Overview
Explicit mapping is an intermediate/advanced feature that extends the current uses functionality. In contrast, to uses, which automatically injects environment variables into host resources based on standard naming conventions, explicit mapping does this explicitly.
Explicit mapping allows explicit association of resource properties (a higher-level object model) with environment variables, which is helpful in multi-dependency scenarios. The uses relationship is automatically derived from this mapping.
This mapping explicitly assigns PRIMARY_EVENT_HUBS_NAME to the name of event-hubs-prod.
Scenario: Handling Multiple Dependencies
When a resource has multiple dependencies of the same type, automatic environment variable injection can cause ambiguity.
Problem
resources:
event-hubs-prod:
type: messaging.eventhubsevent-hubs-dev:
type: messaging.eventhubsmy-app:
type: compute.containerappuses:
- event-hubs-prod
- event-hubs-dev# This would auto-inject environment variables but become ambiguous# Which event hub does AZURE_EVENT_HUBS_NAME refer to?
Proposed Solution
To remove ambiguity, explicit environment variable mapping is used:
The add command will generate default environment variable mappings when adding a second dependency of the same type. Users can override these mappings explicitly to provide meaningful names.
The text was updated successfully, but these errors were encountered:
I think we want uses to be a standard -- because standards are useful. Having standard environment variables reduces the barrier of entry and mental cognitive load. The developer just needs to grab the variables as-is without thinking too much when building up an application.
For example, this could be used as part of #4727 with azd show service-bus.env to show the standard environment variables to connect to it.
Would this also affect azd init?
Possibly. I do think of azd init as a series of azd add over time.
Prelude
${event-hubs-prod.name}
. The design around the object model would be a separate scoped item. This object model may also be required as AVM modules also expose intermediate types that are not the underlying ARM types.Explicit mapping
Overview
Explicit mapping is an intermediate/advanced feature that extends the current
uses
functionality. In contrast, touses
, which automatically injects environment variables into host resources based on standard naming conventions, explicit mapping does this explicitly.Explicit mapping allows explicit association of resource properties (a higher-level object model) with environment variables, which is helpful in multi-dependency scenarios. The
uses
relationship is automatically derived from this mapping.Example Mapping
This mapping explicitly assigns
PRIMARY_EVENT_HUBS_NAME
to thename
ofevent-hubs-prod
.Scenario: Handling Multiple Dependencies
When a resource has multiple dependencies of the same type, automatic environment variable injection can cause ambiguity.
Problem
Proposed Solution
To remove ambiguity, explicit environment variable mapping is used:
Proposed Implementation
The
add
command will generate default environment variable mappings when adding a second dependency of the same type. Users can override these mappings explicitly to provide meaningful names.The text was updated successfully, but these errors were encountered: