@@ -27,7 +27,7 @@ import { createExitPrompter } from '../ui/common/exitPrompter'
2727import { getConfigFileUri , SamConfig , validateSamSyncConfig , writeSamconfigGlobal } from './config'
2828import { cast , Optional } from '../utilities/typeConstructors'
2929import { pushIf , toRecord } from '../utilities/collectionUtils'
30- import { getOverriddenParameters , getParameters } from '../../lambda/config/parameterUtils'
30+ import { getParameters } from '../../lambda/config/parameterUtils'
3131import { addTelemetryEnvVar } from './cli/samCliInvokerUtils'
3232import { samSyncParamUrl , samSyncUrl , samUpgradeUrl } from '../constants'
3333import { openUrl } from '../utilities/vsCodeUtils'
@@ -346,30 +346,22 @@ export async function saveAndBindArgs(args: SyncParams): Promise<{ readonly boun
346346 return { boundArgs }
347347}
348348
349- async function loadLegacyParameterOverrides ( template : TemplateItem ) {
350- try {
351- const params = await getOverriddenParameters ( template . uri )
352- if ( ! params ) {
353- return
354- }
355-
356- return [ ...params . entries ( ) ] . map ( ( [ k , v ] ) => `${ k } =${ v } ` )
357- } catch ( err ) {
358- getLogger ( ) . warn ( `sam: unable to load legacy parameter overrides: %s` , err )
359- }
360- }
361-
362349export async function runSamSync ( args : SyncParams ) {
363350 telemetry . record ( { lambdaPackageType : args . ecrRepoUri !== undefined ? 'Image' : 'Zip' } )
364351
365352 const { path : samCliPath , parsedVersion } = await getSamCliPathAndVersion ( )
366353 const { boundArgs } = await saveAndBindArgs ( args )
367- const overrides = await loadLegacyParameterOverrides ( args . template )
368- if ( overrides !== undefined ) {
369- // Leaving this out of the definitions file as this is _very_ niche and specific to the
370- // implementation. Plus we would have to redefine `sam_sync` to add it.
371- telemetry . record ( { isUsingTemplatesJson : true } as any )
372- boundArgs . push ( '--parameter-overrides' , ...overrides )
354+
355+ if ( ! ! args . templateParameters && Object . entries ( args . templateParameters ) . length > 0 ) {
356+ const templateParameters = new Map < string , string > ( Object . entries ( args . templateParameters ) )
357+ const paramsToSet : string [ ] = [ ]
358+ for ( const [ key , value ] of templateParameters . entries ( ) ) {
359+ if ( value ) {
360+ await updateRecentResponse ( syncMementoRootKey , args . template . uri . fsPath , key , value )
361+ paramsToSet . push ( `ParameterKey=${ key } ,ParameterValue=${ value } ` )
362+ }
363+ }
364+ paramsToSet . length > 0 && boundArgs . push ( '--parameter-overrides' , paramsToSet . join ( ' ' ) )
373365 }
374366
375367 // '--no-watch' was not added until https://github.com/aws/aws-sam-cli/releases/tag/v1.77.0
0 commit comments