@@ -59,7 +59,7 @@ export class ResourceController<T extends StringIndexedObject> {
5959 parameters : Partial < T > ,
6060 ) : Promise < ValidateResponseData [ 'resourceValidations' ] [ 0 ] > {
6161 const originalParameters = structuredClone ( parameters ) ;
62- await this . applyTransformParameters ( parameters ) ;
62+ await this . applyTransformations ( parameters , undefined , true ) ;
6363 this . addDefaultValues ( parameters ) ;
6464
6565 if ( this . schemaValidator ) {
@@ -143,10 +143,10 @@ export class ResourceController<T extends StringIndexedObject> {
143143 const paramsToMatch = structuredClone ( resourceToMatch . parameters ) as Partial < T > ;
144144
145145 this . addDefaultValues ( originalParams ) ;
146- await this . applyTransformParameters ( originalParams ) ;
146+ await this . applyTransformations ( originalParams ) ;
147147
148148 this . addDefaultValues ( paramsToMatch ) ;
149- await this . applyTransformParameters ( paramsToMatch ) ;
149+ await this . applyTransformations ( paramsToMatch ) ;
150150
151151 const match = parameterMatcher ( originalParams , paramsToMatch ) ;
152152 if ( match ) {
@@ -170,10 +170,10 @@ export class ResourceController<T extends StringIndexedObject> {
170170 } ;
171171
172172 this . addDefaultValues ( desired ) ;
173- await this . applyTransformParameters ( desired ) ;
173+ await this . applyTransformations ( desired ) ;
174174
175175 this . addDefaultValues ( state ) ;
176- await this . applyTransformParameters ( state ) ;
176+ await this . applyTransformations ( state ) ;
177177
178178 // Parse data from the user supplied config
179179 const parsedConfig = new ConfigParser ( desired , state , this . parsedSettings . statefulParameters )
@@ -221,7 +221,7 @@ export class ResourceController<T extends StringIndexedObject> {
221221 parameters : Partial < T >
222222 ) : Promise < Plan < T > > {
223223 this . addDefaultValues ( parameters ) ;
224- await this . applyTransformParameters ( parameters ) ;
224+ await this . applyTransformations ( parameters ) ;
225225
226226 // Use refresh parameters if specified, otherwise try to refresh as many parameters as possible here
227227 const parametersToRefresh = this . settings . importAndDestroy ?. refreshKeys
@@ -298,7 +298,7 @@ export class ResourceController<T extends StringIndexedObject> {
298298 }
299299
300300 this . addDefaultValues ( parameters ) ;
301- await this . applyTransformParameters ( parameters ) ;
301+ await this . applyTransformations ( parameters ) ;
302302
303303 // Use refresh parameters if specified, otherwise try to refresh as many parameters as possible here
304304 const parametersToRefresh = this . getParametersToRefreshForImport ( parameters , context ) ;
@@ -325,7 +325,7 @@ export class ResourceController<T extends StringIndexedObject> {
325325 ?. map ( ( r , idx ) => ( { ...r , ...statefulCurrentParameters [ idx ] } ) )
326326
327327 for ( const result of resultParametersArray ) {
328- await this . applyTransformParameters ( result , { original : context . originalDesiredConfig } ) ;
328+ await this . applyTransformations ( result , { original : context . originalDesiredConfig } ) ;
329329 this . removeDefaultValues ( result , parameters ) ;
330330 }
331331
@@ -408,9 +408,9 @@ ${JSON.stringify(refresh, null, 2)}
408408 }
409409 }
410410
411- private async applyTransformParameters ( config : Partial < T > | null , reverse ?: {
411+ private async applyTransformations ( config : Partial < T > | null , reverse ?: {
412412 original : Partial < T > | null
413- } ) : Promise < void > {
413+ } , skipConfigTransformation = false ) : Promise < void > {
414414 if ( ! config ) {
415415 return ;
416416 }
@@ -425,7 +425,7 @@ ${JSON.stringify(refresh, null, 2)}
425425 : await inputTransformation . to ( config [ key ] ) ;
426426 }
427427
428- if ( this . settings . transformation ) {
428+ if ( this . settings . transformation && ! skipConfigTransformation ) {
429429 const transformed = reverse
430430 ? await this . settings . transformation . from ( { ...config } , reverse . original )
431431 : await this . settings . transformation . to ( { ...config } )
0 commit comments