aws-cloudformation / cloudformation-cli

The CloudFormation Provider Development Toolkit allows you to author your own resource providers and modules that can be used by CloudFormation.
Apache License 2.0
316 stars 158 forks source link

CreateOnly properties changing on update causing contract tests fail on wrong error #1080

Open liron-bar-mashiah opened 2 weeks ago

liron-bar-mashiah commented 2 weeks ago

While trying to update a CreateOnlyProperty on the update contract, the expectation is to get the following error: AssertionError: Any createOnlyProperties specified in update handler input MUST NOT be different from their previous state

When the CreateOnlyProperty is an object and one of its fields was modified in the update contract I'm getting the following error: AssertionError: All properties specified in the request MUST be present in the model returned, and they MUST match exactly, with the exception of properties defined as writeOnlyProperties in the resource schema

updating a primitive property (e.g. string) for example:

  "prop": {
      "type": "string",
  },

will lead to the expected error.

updating an object property field for example:

  "prop": {
      "type": "object",
      "properties": {
          "a": {
              "type": "string"
          },
          "b": {
              "type": "string"
          }
      },
      "additionalProperties": false
  },

in case the update contract updates "a" or "b" the second error is issued.