@@ -92,7 +92,10 @@ export async function updateResourceProperties(
9292 template : string ,
9393 resourceType : string ,
9494 resourceName : string ,
95- modifications : { propertyName : string ; propertyValue : string } [ ] ,
95+ modifications : {
96+ propertyName : string ;
97+ propertyValue : string | number | boolean ;
98+ } [ ] ,
9699) : Promise < string > {
97100 validateIdentifier ( resourceType , 'Resource type' ) ;
98101 validateIdentifier ( resourceName , 'Resource name' ) ;
@@ -110,7 +113,9 @@ export async function updateResourceProperties(
110113 const updates = [ ] ;
111114 for ( const modification of modifications ) {
112115 const propertyName = modification . propertyName ;
113- const propertyValue = sanitizePropertyValue ( modification . propertyValue ) ;
116+ const propertyValue = escapeAttributeValue (
117+ modification . propertyValue ,
118+ ) . replace ( / " / g, '\\"' ) ;
114119
115120 const attributeCommand = await getAttributeCommand (
116121 filePath ,
@@ -247,20 +252,3 @@ async function executeHclEditCommand(
247252) : Promise < CommandResult > {
248253 return await executeCommand ( '/bin/bash' , [ '-c' , `hcledit ${ parameters } ` ] ) ;
249254}
250-
251- function sanitizePropertyValue ( propertyValue : string ) : string {
252- // In the future we may need to check the type.
253- // We currently only support number boolean and string
254-
255- propertyValue = propertyValue . trim ( ) ;
256-
257- if (
258- Number . isInteger ( Number ( propertyValue ) ) ||
259- propertyValue === 'false' ||
260- propertyValue === 'true'
261- ) {
262- return propertyValue ;
263- }
264-
265- return `\\"${ propertyValue } \\"` ;
266- }
0 commit comments