mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 21:27:31 +00:00
feat(integrations): aws secrets manager prefix support
This commit is contained in:
@@ -1006,12 +1006,28 @@ const syncSecretsAWSSecretManager = async ({
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let secretsToProcess: Record<string, { value: string; comment?: string }> = {};
|
||||||
|
if (metadata && metadata.secretPrefix) {
|
||||||
|
const { secretPrefix } = metadata;
|
||||||
|
|
||||||
|
// Update each secret to have the secret prefix
|
||||||
|
Object.keys(secrets).forEach((key) => {
|
||||||
|
if (key.startsWith(secretPrefix)) {
|
||||||
|
secretsToProcess[key] = secrets[key];
|
||||||
|
} else {
|
||||||
|
secretsToProcess[`${secretPrefix}${key}`] = secrets[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
secretsToProcess = secrets;
|
||||||
|
}
|
||||||
|
|
||||||
if (metadata.mappingBehavior === IntegrationMappingBehavior.ONE_TO_ONE) {
|
if (metadata.mappingBehavior === IntegrationMappingBehavior.ONE_TO_ONE) {
|
||||||
for await (const [key, value] of Object.entries(secrets)) {
|
for await (const [key, value] of Object.entries(secretsToProcess)) {
|
||||||
await processAwsSecret(key, value.value);
|
await processAwsSecret(key, value.value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await processAwsSecret(integration.app as string, getSecretKeyValuePair(secrets));
|
await processAwsSecret(integration.app as string, getSecretKeyValuePair(secretsToProcess));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
const [tagKey, setTagKey] = useState("");
|
const [tagKey, setTagKey] = useState("");
|
||||||
const [tagValue, setTagValue] = useState("");
|
const [tagValue, setTagValue] = useState("");
|
||||||
const [kmsKeyId, setKmsKeyId] = useState("");
|
const [kmsKeyId, setKmsKeyId] = useState("");
|
||||||
|
const [secretPrefix, setSecretPrefix] = useState("");
|
||||||
|
|
||||||
// const [path, setPath] = useState('');
|
// const [path, setPath] = useState('');
|
||||||
// const [pathErrorText, setPathErrorText] = useState('');
|
// const [pathErrorText, setPathErrorText] = useState('');
|
||||||
@@ -165,6 +166,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
: {}),
|
: {}),
|
||||||
|
...(secretPrefix && { secretPrefix }),
|
||||||
...(kmsKeyId && { kmsKeyId }),
|
...(kmsKeyId && { kmsKeyId }),
|
||||||
mappingBehavior: selectedMappingBehavior
|
mappingBehavior: selectedMappingBehavior
|
||||||
}
|
}
|
||||||
@@ -325,7 +327,7 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
{shouldTag && (
|
{shouldTag && (
|
||||||
<div className="mt-4">
|
<div className="mt-4 flex justify-between">
|
||||||
<FormControl label="Tag Key">
|
<FormControl label="Tag Key">
|
||||||
<Input
|
<Input
|
||||||
placeholder="managed-by"
|
placeholder="managed-by"
|
||||||
@@ -342,10 +344,20 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
</FormControl>
|
</FormControl>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<FormControl label="Secret Prefix" className="mt-4">
|
||||||
|
<Input
|
||||||
|
value={secretPrefix}
|
||||||
|
onChange={(e) => setSecretPrefix(e.target.value)}
|
||||||
|
placeholder="INFISICAL_"
|
||||||
|
/>
|
||||||
|
</FormControl>
|
||||||
|
|
||||||
<FormControl label="Encryption Key" className="mt-4">
|
<FormControl label="Encryption Key" className="mt-4">
|
||||||
<Select
|
<Select
|
||||||
value={kmsKeyId}
|
value={kmsKeyId}
|
||||||
onValueChange={(e) => {
|
onValueChange={(e) => {
|
||||||
|
if (e === "no-keys") return;
|
||||||
setKmsKeyId(e);
|
setKmsKeyId(e);
|
||||||
}}
|
}}
|
||||||
className="w-full border border-mineshaft-500"
|
className="w-full border border-mineshaft-500"
|
||||||
@@ -363,7 +375,9 @@ export default function AWSSecretManagerCreateIntegrationPage() {
|
|||||||
);
|
);
|
||||||
})
|
})
|
||||||
) : (
|
) : (
|
||||||
<div />
|
<SelectItem isDisabled value="no-keys" key="no-keys">
|
||||||
|
No KMS keys available
|
||||||
|
</SelectItem>
|
||||||
)}
|
)}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|||||||
Reference in New Issue
Block a user