Filter location prompts by resource provider availability #6502
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Users were selecting regions where project services aren't available, causing provision failures (e.g., Static Web Apps unavailable in France Central).
Implementation
Resource Type Extraction (
pkg/azure/arm_template.go)resources[]array["Microsoft.App/containerApps", "Microsoft.DBforPostgreSQL/flexibleServers"]Provider Availability Check (
pkg/account/subscriptions.go)Integration (
pkg/infra/provisioning/bicep/)EnsureEnv()after Bicep compilationPromptLocationWithResourceTypes()methodallowedValuesand quota filteringInterface Extensions
Manager.GetLocationsWithFilter(resourceTypes []string)- filtered location retrievalPrompter.PromptLocationWithResourceTypes(resourceTypes []string)- filtered promptingEnsureSubscriptionAndLocationOptions.ResourceTypes- provisioning optionsExample
Project using Container Apps + PostgreSQL:
Notes
resourceTypesis nil/empty, no filtering occursWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
code.cloudfoundry.org/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)dario.cat/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)go.googlesource.com/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)go.opentelemetry.io/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)go.uber.org/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)google.golang.org/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)gopkg.in/update-job-proxy /update-job-proxy DROP bin/bash test -e cef98f5.0 /opt/hostedtoolc-e /bin/test rvice-availabili/usr/bin/git -buildtags /home/REDACTED/.do--global test -e oot_CA_2022.pem git est 1db302536c17e6f4/usr/sbin/iptables les ache/go/1.25.5/x-t test(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>Filter Region list by provider/service availability being used in project</issue_title>
<issue_description>Findings are showing that there are unsuccessful provision attempts due to services/providers not available in the region selected for a service that is in the project.
We are already filtering the available regions by subscription, we can add the services in the project as an additional filter to further reduce the list.
There are some of the templates that attempt to do this via the
allowedparameter in the bicep files, but this is a manual list and has room for error.Proposed solution -
Extend Existing Method with Optional Filtering
A backwards-compatible approach would be to add optional parameters:
Integration with Existing Prompt System
You would also need to update the prompt system to use the filtered locations. This would involve modifying
pkg/azureutil/location.goWe would have to parse the bicep files for the services.</issue_description>
Comments on the Issue (you are @copilot in this section)
@weikanglim @spboyer Do you have a couple of a quick examples in mind?I suspect what this ends up looking, in the case of a single location being used across multiple resources, could look like: