diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts index c83234c1f..3e730048b 100644 --- a/backend/src/lib/api-docs/constants.ts +++ b/backend/src/lib/api-docs/constants.ts @@ -585,12 +585,12 @@ export const INTEGRATION = { region: "AWS region to sync secrets to.", scope: "Scope of the provider. Used by Github, Qovery", metadata: { - secretPrefix: "The prefix for the saved secret. Used by GCP", - secretSuffix: "The suffix for the saved secret. Used by GCP", - initialSyncBehavoir: "Type of syncing behavoir with the integration", - shouldAutoRedeploy: "Used by Render to trigger auto deploy", - secretGCPLabel: "The label for the GCP secrets", - secretAWSTag: "The tag for the AWS secrets" + secretPrefix: "The prefix for the saved secret. Used by GCP.", + secretSuffix: "The suffix for the saved secret. Used by GCP.", + initialSyncBehavoir: "Type of syncing behavoir with the integration.", + shouldAutoRedeploy: "Used by Render to trigger auto deploy.", + secretGCPLabel: "The label for GCP secrets.", + secretAWSTag: "The tags for AWS secrets." } }, UPDATE: { diff --git a/backend/src/server/routes/v1/integration-router.ts b/backend/src/server/routes/v1/integration-router.ts index 58a8917c5..29ccce0a8 100644 --- a/backend/src/server/routes/v1/integration-router.ts +++ b/backend/src/server/routes/v1/integration-router.ts @@ -58,10 +58,12 @@ export const registerIntegrationRouter = async (server: FastifyZodProvider) => { .optional() .describe(INTEGRATION.CREATE.metadata.secretGCPLabel), secretAWSTag: z - .object({ - key: z.string(), - value: z.string() - }) + .array( + z.object({ + key: z.string(), + value: z.string() + }) + ) .optional() .describe(INTEGRATION.CREATE.metadata.secretAWSTag) }) diff --git a/backend/src/services/integration-auth/integration-sync-secret.ts b/backend/src/services/integration-auth/integration-sync-secret.ts index 48226bb59..267c50516 100644 --- a/backend/src/services/integration-auth/integration-sync-secret.ts +++ b/backend/src/services/integration-auth/integration-sync-secret.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/no-unsafe-call */ /* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-argument */ @@ -489,7 +490,9 @@ const syncSecretsAWSParameterStore = async ({ Type: "SecureString", Value: secrets[key].value, // Overwrite: true, - Tags: metadata.secretAWSTag ? [{ Key: metadata.secretAWSTag.key, Value: metadata.secretAWSTag.value }] : [] + Tags: metadata.secretAWSTag + ? metadata.secretAWSTag.map((tag: { key: string; value: string }) => ({ Key: tag.key, Value: tag.value })) + : [] }) .promise(); // case: secret exists in AWS parameter store @@ -579,7 +582,9 @@ const syncSecretsAWSSecretManager = async ({ new CreateSecretCommand({ Name: integration.app as string, SecretString: JSON.stringify(secKeyVal), - Tags: metadata.secretAWSTag ? [{ Key: metadata.secretAWSTag.key, Value: metadata.secretAWSTag.value }] : [] + Tags: metadata.secretAWSTag + ? metadata.secretAWSTag.map((tag: { key: string; value: string }) => ({ Key: tag.key, Value: tag.value })) + : [] }) ); } diff --git a/backend/src/services/integration/integration-types.ts b/backend/src/services/integration/integration-types.ts index 93c36cd8e..053ea4463 100644 --- a/backend/src/services/integration/integration-types.ts +++ b/backend/src/services/integration/integration-types.ts @@ -25,7 +25,7 @@ export type TCreateIntegrationDTO = { secretAWSTag?: { key: string; value: string; - }; + }[]; }; } & Omit; diff --git a/frontend/src/hooks/api/integrations/queries.tsx b/frontend/src/hooks/api/integrations/queries.tsx index 7804f0951..4f2088053 100644 --- a/frontend/src/hooks/api/integrations/queries.tsx +++ b/frontend/src/hooks/api/integrations/queries.tsx @@ -66,7 +66,7 @@ export const useCreateIntegration = () => { secretAWSTag?: { key: string; value: string; - }; + }[]; }; }) => { const { diff --git a/frontend/src/pages/integrations/aws-parameter-store/create.tsx b/frontend/src/pages/integrations/aws-parameter-store/create.tsx index dd643023c..92e4662a9 100644 --- a/frontend/src/pages/integrations/aws-parameter-store/create.tsx +++ b/frontend/src/pages/integrations/aws-parameter-store/create.tsx @@ -128,10 +128,10 @@ export default function AWSParameterStoreCreateIntegrationPage() { metadata: { ...(shouldTag ? { - secretAWSTag: { + secretAWSTag: [{ key: tagKey, value: tagValue - } + }] } : {}) } @@ -279,7 +279,7 @@ export default function AWSParameterStoreCreateIntegrationPage() { label="Tag Value" > setTagValue(e.target.value)} /> diff --git a/frontend/src/pages/integrations/aws-secret-manager/create.tsx b/frontend/src/pages/integrations/aws-secret-manager/create.tsx index ee06fe6c1..de8e3628c 100644 --- a/frontend/src/pages/integrations/aws-secret-manager/create.tsx +++ b/frontend/src/pages/integrations/aws-secret-manager/create.tsx @@ -127,10 +127,10 @@ export default function AWSSecretManagerCreateIntegrationPage() { metadata: { ...(shouldTag ? { - secretAWSTag: { + secretAWSTag: [{ key: tagKey, value: tagValue - } + }] } : {}) } @@ -278,7 +278,7 @@ export default function AWSSecretManagerCreateIntegrationPage() { label="Tag Value" > setTagValue(e.target.value)} /> diff --git a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/IntegrationsSection.tsx b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/IntegrationsSection.tsx index 8125bc6ad..a9045eb5a 100644 --- a/frontend/src/views/IntegrationsPage/components/IntegrationsSection/IntegrationsSection.tsx +++ b/frontend/src/views/IntegrationsPage/components/IntegrationsSection/IntegrationsSection.tsx @@ -74,7 +74,7 @@ export const IntegrationsSection = ({ )} {!isLoading && isBotActive && ( -
+
{integrations?.map((integration) => (