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 157 forks source link

Contract tests attempting test_create_list on resource that doesn't support list #997

Closed bengluca closed 1 year ago

bengluca commented 1 year ago

I am an AWS SDE attempting to onboard the AWS::MediaTailor::Channel resource to cloudformation. A Channel can have at most one attached ChannelPolicy which is added via a separate API call (ie PutChannelPolicy, not CreateChannel or UpdateChannel) and so we decided to model it as a separate resource in CloudFormation.

In my schema, I have described handlers for create, read, update, and delete, but not List. I have followed the directions in the UluruContractTests wiki and can run the v2 contract tests. However, one of the tests fails:

{
  "Operation": "mutate_inputs",
  "ProvidedTypeName": "AWS::MediaTailor::ChannelPolicy",
  "TypeName": "ContractTestCEX95::MediaTailor::ChannelPolicy",
  "TestDetail": "TestCreate, test_create_list",
  "Bucket": "bengluca-cfn-test",
  "DesiredState": {
    "ChannelName": "cloudformation-test-channel",
    "Policy": {
      "Version": "2012-10-17",
      "Statement": [
        {
          "Sid": "AllowAnonymous",
          "Effect": "Allow",
          "Principal": "*",
          "Action": "mediatailor:GetManifest",
          "Resource": "arn:aws:mediatailor:us-west-2:727504984401:channel/cloudformation-test-channel"
        }
      ]
    }
  }

The resulting error found in the Docker logs is: List Handler Failed for type ContractTestCEX95::MediaTailor::ChannelPolicy with error An error occurred (UnsupportedActionException) when calling the ListResources operation: Resource type arn:aws:cloudformation:us-west-2:727504984401:type/resource/ContractTestCEX95-MediaTailor-ChannelPolicy/00000001 does not support LIST action.

A sage post (ID 1131941) said that removing list from my schema handlers should be enough to prevent this, and I should file an issue here if not.

mmaeng commented 1 year ago

Hi,

The current CLI runs CTV1 contract tests on the workstation. For questions about the CTV2 tests you will have to reach out to the CloudFormation team.

For the cloudformation CLI if the schema json file does not have a LIST handler the LIST tests will be skipped (client side).