chore: limit regions for nimbus (#38747)

* chore: limit regions for nimbus

* fix logic

* Autoselect east US if cloud provider is nimbus

---------

Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
This commit is contained in:
Alaister Young
2025-09-25 16:09:15 +08:00
committed by GitHub
parent 87c56233e7
commit e7cac83c4a
4 changed files with 12 additions and 11 deletions

View File

@@ -15,8 +15,12 @@ export function getAvailableRegions(cloudProvider: CloudProvider): Region {
switch (cloudProvider) {
case 'AWS':
case 'AWS_K8S':
case 'AWS_NIMBUS':
return AWS_REGIONS
case 'AWS_NIMBUS':
// Only allow US East for Nimbus
return {
EAST_US: AWS_REGIONS.EAST_US,
}
case 'FLY':
return FLY_REGIONS
default:

View File

@@ -45,13 +45,7 @@ export const RegionSelector = ({
)
const { data: availableRegionsData, isLoading: isLoadingAvailableRegions } =
useOrganizationAvailableRegionsQuery(
{
slug,
cloudProvider,
},
{ enabled: smartRegionEnabled }
)
useOrganizationAvailableRegionsQuery({ slug, cloudProvider }, { enabled: smartRegionEnabled })
const smartRegions = availableRegionsData?.all.smartGroup ?? []
const allRegions = availableRegionsData?.all.specific ?? []

View File

@@ -66,7 +66,7 @@ import {
} from 'lib/constants'
import passwordStrength from 'lib/password-strength'
import { generateStrongPassword } from 'lib/project'
import type { CloudProvider } from 'shared-data'
import { AWS_REGIONS, type CloudProvider } from 'shared-data'
import type { NextPageWithLayout } from 'types'
import {
Badge,
@@ -159,6 +159,7 @@ const Wizard: NextPageWithLayout = () => {
const projectCreationDisabled = useFlag('disableProjectCreationAndUpdate')
const showPostgresVersionSelector = useFlag('showPostgresVersionSelector')
const cloudProviderEnabled = useFlag('enableFlyCloudProvider')
const { data: membersExceededLimit } = useFreeProjectLimitCheckQuery(
{ slug },
{ enabled: isFreePlan }
@@ -258,7 +259,9 @@ const Wizard: NextPageWithLayout = () => {
const regionError = smartRegionEnabled ? availableRegionsError : defaultRegionError
const defaultRegion = smartRegionEnabled
? availableRegionsData?.recommendations.smartGroup.name
: _defaultRegion
: defaultProvider === 'AWS_NIMBUS'
? AWS_REGIONS.EAST_US.displayName
: _defaultRegion
const { can: isAdmin } = useAsyncCheckPermissions(PermissionAction.CREATE, 'projects')

View File

@@ -1,5 +1,5 @@
export type CloudProvider = 'FLY' | 'AWS' | 'AWS_K8S' | 'AWS_NIMBUS'
export type Region = typeof AWS_REGIONS | typeof FLY_REGIONS
export type Region = Partial<typeof AWS_REGIONS> | Partial<typeof FLY_REGIONS>
export const AWS_REGIONS = {
WEST_US: {