aws-cloudformation / aws-cloudformation/cloudformation-cli

Rely on the contract, not the implementation

Open
#798 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
336
Forks
172
Avg merge
3d 5m
Merged PRs (30d)
3

Description

One of the big problems we have with cfn cli is that it heavily depends on the implementation details, rather than contracts. One of the very particular examples here is when we try to publish a type provider that is developed using `provided` runtime - we develop our Lambdas using GraalVM and it required a bit of "hacking" to make it working as CloudFormation type provider ( https://wrzasq.pl/blog/cloudformation-custom-resource-providers-with-any-runtime-any-toolchain-any.html ). Now, trying to just publish the type I can see the following error in the logs published to S3:

```
[2021-07-11T23:59:03Z] DEBUG - Caught exit recommendation
Traceback (most recent call last):
File "/root/.pyenv/versions/3.7.6/lib/python3.7/site-packages/rpdk/core/project.py", line 224, in validate_and_load_resource_settings
SETTINGS_VALIDATOR.validate(raw_settings)
File "/root/.pyenv/versions/3.7.6/lib/python3.7/site-packages/jsonschema/validators.py", line 353, in validate
raise error
jsonschema.exceptions.ValidationError: 'provided.al2' is not one of ['nodejs10.x', 'nodejs12.x', 'go1.x', 'nodejs14.x', 'noexec', 'dotnetcore2.1', 'python3.6', 'python3.7', 'java8', 'python3.8', 'java11']

Failed validating 'enum' in schema['properties']['runtime']:
{'enum': ['nodejs10.x',
'nodejs12.x',
'go1.x',
'nodejs14.x',
'noexec',
'dotnetcore2.1',
'python3.6',
'python3.7',
'java8',
'python3.8',
'java11'],
'type': 'string'}

On instance['runtime']:
'provided.al2'
```

So even though the resource type works on the account, interacting properly with all AWS API interfaces, it fails validation of cfn-cli because it assumes some implementation details (in this case a runtime, but maybe some more things apart of it).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.