Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
allow region to be set for global scope
Matheus Nogueira069d4da4d650
diff --git a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts b/backend/src/services/secret-sync/gcp/gcp-sync-fns.tsindex d51383fefb..92e863799c 100644--- a/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts+++ b/backend/src/services/secret-sync/gcp/gcp-sync-fns.ts@@ -123,9 +123,15 @@ export const GcpSyncFns = {{replication:destinationConfig.scope === GcpSyncScope.Global- ? {- automatic: {}- }+ ? destinationConfig.locationId+ ? {+ userManaged: {+ replicas: [{ location: destinationConfig.locationId }]+ }+ }+ : {+ automatic: {}+ }: undefined},{diff --git a/backend/src/services/secret-sync/gcp/gcp-sync-schemas.ts b/backend/src/services/secret-sync/gcp/gcp-sync-schemas.tsindex 8ea5d273ed..71e04dc7d7 100644--- a/backend/src/services/secret-sync/gcp/gcp-sync-schemas.ts+++ b/backend/src/services/secret-sync/gcp/gcp-sync-schemas.ts@@ -19,7 +19,11 @@ const GcpSyncDestinationConfigSchema = z.discriminatedUnion("scope", [z.object({scope: z.literal(GcpSyncScope.Global).describe(SecretSyncs.DESTINATION_CONFIG.GCP.scope),- projectId: z.string().min(1, "Project ID is required").describe(SecretSyncs.DESTINATION_CONFIG.GCP.projectId)+ projectId: z.string().min(1, "Project ID is required").describe(SecretSyncs.DESTINATION_CONFIG.GCP.projectId),+ locationId: z+ .nativeEnum(GCPSecretManagerLocation)+ .optional()+ .describe(SecretSyncs.DESTINATION_CONFIG.GCP.locationId)}).describe(JSON.stringify({diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsxindex 6575d1ca93..f443165aa5 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncDestinationFields/GcpSyncFields.tsx@@ -156,23 +156,41 @@ export const GcpSyncFields = () => {</Field>)}/>- {selectedScope === GcpSyncScope.Region && (+ {(selectedScope === GcpSyncScope.Region || selectedScope === GcpSyncScope.Global) && (<Controllername="destinationConfig.locationId"control={control}render={({ field: { value, onChange }, fieldState: { error } }) => (<Field>- <FieldLabel>Region</FieldLabel>+ <FieldLabel>+ Region+ {selectedScope === GcpSyncScope.Global && (+ <Tooltip>+ <TooltipTrigger asChild>+ <Info />+ </TooltipTrigger>+ <TooltipContent className="max-w-md">+ Optionally specify a region for user-managed replication. If not set, automatic+ replication will be used.+ </TooltipContent>+ </Tooltip>+ )}+ </FieldLabel><FieldContent><FilterableSelectisLoading={areLocationsPending && Boolean(projectId)}isDisabled={!projectId}+ isClearable={selectedScope === GcpSyncScope.Global}value={locations?.find((option) => option.locationId === value) ?? null}onChange={(option) =>- onChange((option as SingleValue<TGcpLocation>)?.locationId ?? null)+ onChange((option as SingleValue<TGcpLocation>)?.locationId ?? "")}options={locations}- placeholder="Select a region..."+ placeholder={+ selectedScope === GcpSyncScope.Global+ ? "Automatic replication"+ : "Select a region..."+ }getOptionValue={(option) => option.locationId}formatOptionLabel={formatOptionLabel}/>diff --git a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GcpSyncReviewFields.tsx b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GcpSyncReviewFields.tsxindex f0efef3353..0ea76d671a 100644--- a/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GcpSyncReviewFields.tsx+++ b/frontend/src/components/secret-syncs/forms/SecretSyncReviewFields/GcpSyncReviewFields.tsx@@ -21,7 +21,8 @@ export const GcpSyncReviewFields = () => {<DetailLabel>Scope</DetailLabel><DetailValue className="capitalize">{destinationConfig.scope}</DetailValue></Detail>- {destinationConfig.scope === GcpSyncScope.Region && (+ {(destinationConfig.scope === GcpSyncScope.Region ||+ (destinationConfig.scope === GcpSyncScope.Global && destinationConfig.locationId)) && (<Detail><DetailLabel>Region</DetailLabel><DetailValue>{destinationConfig.locationId}</DetailValue>diff --git a/frontend/src/components/secret-syncs/forms/schemas/gcp-sync-destination-schema.ts b/frontend/src/components/secret-syncs/forms/schemas/gcp-sync-destination-schema.tsindex fffae153e7..6d1a73384c 100644--- a/frontend/src/components/secret-syncs/forms/schemas/gcp-sync-destination-schema.ts+++ b/frontend/src/components/secret-syncs/forms/schemas/gcp-sync-destination-schema.ts@@ -10,7 +10,11 @@ export const GcpSyncDestinationSchema = BaseSecretSyncSchema().merge(destinationConfig: z.discriminatedUnion("scope", [z.object({scope: z.literal(GcpSyncScope.Global),- projectId: z.string().min(1, "Project ID required")+ projectId: z.string().min(1, "Project ID required"),+ locationId: z+ .string()+ .optional()+ .transform((val) => val || undefined)}),z.object({scope: z.literal(GcpSyncScope.Region),diff --git a/frontend/src/hooks/api/secretSyncs/types/gcp-sync.ts b/frontend/src/hooks/api/secretSyncs/types/gcp-sync.tsindex b7b9c1db89..178f7e0b39 100644--- a/frontend/src/hooks/api/secretSyncs/types/gcp-sync.ts+++ b/frontend/src/hooks/api/secretSyncs/types/gcp-sync.ts@@ -13,6 +13,7 @@ export type TGcpSync = TRootSecretSync & {| {scope: GcpSyncScope.Global;projectId: string;+ locationId?: string;}| {scope: GcpSyncScope.Region;diff --git a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.tsindex 2c2ea76120..04c6b4d049 100644--- a/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts+++ b/frontend/src/pages/secret-manager/IntegrationsListPage/components/SecretSyncsTab/SecretSyncTable/helpers/index.ts@@ -54,7 +54,11 @@ export const getSecretSyncDestinationColValues = (secretSync: TSecretSync) => {case SecretSync.GCPSecretManager:primaryText = destinationConfig.projectId;secondaryText =- destinationConfig.scope === GcpSyncScope.Global ? "Global" : destinationConfig.locationId;+ destinationConfig.scope === GcpSyncScope.Global+ ? destinationConfig.locationId+ ? `Global - ${destinationConfig.locationId}`+ : "Global"+ : destinationConfig.locationId;break;case SecretSync.AzureKeyVault:primaryText = destinationConfig.vaultBaseUrl;diff --git a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GcpSyncDestinationSection.tsx b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GcpSyncDestinationSection.tsxindex a8aa05702d..fe8876ff9e 100644--- a/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GcpSyncDestinationSection.tsx+++ b/frontend/src/pages/secret-manager/SecretSyncDetailsByIDPage/components/SecretSyncDestinationSection/GcpSyncDestinationSection.tsx@@ -18,7 +18,8 @@ export const GcpSyncDestinationSection = ({ secretSync }: Props) => {<DetailLabel>Scope</DetailLabel><DetailValue>{destinationConfig.scope}</DetailValue></Detail>- {destinationConfig.scope === GcpSyncScope.Region && (+ {(destinationConfig.scope === GcpSyncScope.Region ||+ (destinationConfig.scope === GcpSyncScope.Global && destinationConfig.locationId)) && (<Detail><DetailLabel>Region</DetailLabel><DetailValue>{destinationConfig.locationId}</DetailValue>