Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: existing resource support #4577

Open
Tracked by #4538
weikanglim opened this issue Nov 21, 2024 · 3 comments
Open
Tracked by #4538

compose: existing resource support #4577

weikanglim opened this issue Nov 21, 2024 · 3 comments
Labels
compose composability
Milestone

Comments

@weikanglim
Copy link
Contributor

weikanglim commented Nov 21, 2024

Background

This issue tracks the ability to reference existing resources in azure.yaml.

For example, the schema could look something like:

resources:
  existing-db:
    id: <Azure Resource ID>

This enhancement builds on top of the idea that azure.yaml is representing the app-centric view of the infrastructure resources. Similar to a SQL view, resources can either be created (materialized in SQL terms) or existing (queried from in SQL terms).

Scenarios

When this type of reference metadata is present, scenarios we would want to enable for overall consistency of the system:

  1. use binding relationships works with existing resources. We could imagine that environment variables are established in the same way a created resource does. This would require updating the infra synthesis to account for existing declarations.
  2. Command gestures like show works with existing resources. This change would be a minimal addition of the currently established design, that each resource maps to an AZURE_RESOURCE_xx_ID upon provisioning. See compose: show <resource> #4534 for details.
@weikanglim weikanglim added the compose composability label Nov 21, 2024
@weikanglim weikanglim added this to the Selenium milestone Nov 21, 2024
@timngmsft
Copy link

Have you given thought to separating the resource ids from the yaml file? There’s two reasons I’ve been thinking about:

  1. Maybe resource ids shouldn’t be checked into a repository
  2. If you end up separating it, it’s possible to support multiple “environments”?

For example, you could put the resource ids in “dev.env” and “prod.env” and azure.yaml can reference the IDs in these environment files?

What do you think of that kind of approach?

@weikanglim
Copy link
Contributor Author

weikanglim commented Nov 22, 2024

100% agree that multiple environments scenarios should always be supported.

Current established paradigms:

There are many ways we can do that, currently:

  1. The current, already supported approach. Define in azure.yaml, reference the environment variable:
resources:
  existing-db:
    id: ${ACTUAL_ID_KEY}
  1. Define environment variable directly: ${AZURE_RESOURCE_xx_ID} -- This could serve as an override.

Future Improvements

Some alternative improvements over the long run:

  1. More explicit parameterization with ${env.someId}
  2. Some other wild ideas: Explicit configuration files that are merged together, this are now source-control managed. Perhaps you could think of:
    • azure.yaml
    • azure.prod.yaml - With prod specific configuration

I personally see that 1 and 2 become increasing cumbersome over the long run, and perhaps at some breaking point, separate configuration files are more maintainable.

I do very much see the need to have a system of this essence very clearly in-place and well-documented as a pattern.

@timngmsft
Copy link

I think using the environment variable is actually a fine approach; users can then supply the right system environment variables as they need.

The "azure.yaml" and "azure.prod.yaml" is interesting - have you heard of customers needing different settings in dev/prod? I remember talking to some customers about it and it seems to resolve around configuration - for example, the dev environment has smaller VMs, lower SLAs, etc. This would be possible using the environment approach as well correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compose composability
Projects
None yet
Development

No branches or pull requests

2 participants