Skip to content

Commit

Permalink
fix: add retained secrets to syncSecretDeltas
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Oct 3, 2023
1 parent 2db3e18 commit 52263f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
"@yarn/plugin-typescript"
]
},
"packageManager": "yarn@3.5.0",
"packageManager": "yarn@3.6.3",
"resolutions": {
"aws-sdk": "^2.1464.0",
"cross-fetch": "^2.2.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ export class FunctionSecretsStateManager {
return;
}
const cloudSecretNames = await this.getCloudFunctionSecretNames(functionName);
const addedSecrets = localSecretNames.filter((name) => !cloudSecretNames.includes(name));
const retainedSecrets: string[] = [];
const addedSecrets: string[] = [];

localSecretNames.forEach((name) => (cloudSecretNames.includes(name) ? retainedSecrets.push(name) : addedSecrets.push(name)));

if (!addedSecrets.length) {
return;
}
Expand All @@ -118,8 +122,12 @@ export class FunctionSecretsStateManager {
link: 'https://docs.amplify.aws/cli/reference/ssm-parameter-store/#manually-creating-parameters',
});
}

const current = secretNamesToSecretDeltas(retainedSecrets);
const delta = await prePushMissingSecretsWalkthrough(functionName, addedSecrets);
await this.syncSecretDeltas(delta, functionName);
const secretDeltas = { ...current, ...delta };

await this.syncSecretDeltas(secretDeltas, functionName);
};

/**
Expand Down

0 comments on commit 52263f1

Please sign in to comment.