diff --git a/src/main/java/software/amazon/cloudformation/LambdaWrapper.java b/src/main/java/software/amazon/cloudformation/LambdaWrapper.java index c8bfdcad..be35beca 100644 --- a/src/main/java/software/amazon/cloudformation/LambdaWrapper.java +++ b/src/main/java/software/amazon/cloudformation/LambdaWrapper.java @@ -186,7 +186,6 @@ public void handleRequest(final InputStream inputStream, final OutputStream outp this.lambdaLogger = context.getLogger(); ProgressEvent handlerResponse = null; HandlerRequest request = null; - String bearerToken = null; scrubFiles(); try { if (inputStream == null) { @@ -374,7 +373,13 @@ private void writeResponse(final OutputStream outputStream, final ProgressEvent< ResourceT model = response.getResourceModel(); if (model != null) { JSONObject modelObject = new JSONObject(this.serializer.serialize(model)); - ResourceTypeSchema.load(provideResourceSchemaJSONObject()).removeWriteOnlyProperties(modelObject); + + // strip write only properties on final results, we will need the intact model + // while provisioning + if (response.getStatus() != OperationStatus.IN_PROGRESS) { + ResourceTypeSchema.load(provideResourceSchemaJSONObject()).removeWriteOnlyProperties(modelObject); + } + ResourceT sanitizedModel = this.serializer.deserializeStrict(modelObject.toString(), getModelTypeReference()); response.setResourceModel(sanitizedModel); diff --git a/src/test/java/software/amazon/cloudformation/LambdaWrapperTest.java b/src/test/java/software/amazon/cloudformation/LambdaWrapperTest.java index 8b104bad..344691f3 100644 --- a/src/test/java/software/amazon/cloudformation/LambdaWrapperTest.java +++ b/src/test/java/software/amazon/cloudformation/LambdaWrapperTest.java @@ -330,7 +330,6 @@ public void invokeHandler_CompleteSynchronously_returnsSuccess(final String requ @Test public void invokeHandler_DependenciesInitialised_CompleteSynchronously_returnsSuccess() throws IOException { - final Action action = Action.CREATE; final WrapperOverride wrapper = new WrapperOverride(); final TestModel model = new TestModel();