aws-cloudformation / aws-cloudformation/cloudformation-cli

CloudFormation service cast most types into strings

Open
#435 0 comments 3 reactions 1 assignee Claimed by @kddejong View on GitHub
question researching
Dominant language
Python
Stars
336
Forks
172
Avg merge
3d 5m
Merged PRs (30d)
3

Description

It is probably a known limitation, but I could not find another public issue to track this.

Whenever you develop a resource provider you define a detailed JSON schema, but that schema is not being fully used by the CloudFormation service. For instance, if one is defined like this (full version [here](https://github.com/eduardomourar/aws-resource-provider-passwordpolicy)):

```json
{
"typeName": "OC::Organizations::PasswordPolicy",
"properties": {
"MinimumPasswordLength": {
"type": "integer"
},
"RequireLowercaseCharacters": {
"type": "boolean"
},
...
},
...
}
```

If I try to create that resource in AWS using the following template:

```yaml
AWSTemplateFormatVersion: '2010-09-09'

Resources:
PasswordPolicy:
Type: OC::Organizations::PasswordPolicy
Properties:
MinimumPasswordLength: 8
RequireLowercaseCharacters: True
```

I would expect to receive the input JSON below:

```json
{
"requestData": {
"resourceProperties": {
"MinimumPasswordLength": 8,
"RequireLowercaseCharacters": true,
...
},
...
},
...
}
```

Instead CloudFormation sends this event data where every property is being cast to string:

```json
{
"awsAccountId": ,
"bearerToken": ,
"region": "eu-central-1",
"responseEndpoint": "https://cloudformation.eu-central-1.amazonaws.com",
"action": "CREATE",
"nextToken": null,
"resourceType": "OC::Organizations::PasswordPolicy",
"resourceTypeVersion": "00000029",
"requestData": {
"logicalResourceId": "PasswordPolicy",
"resourceProperties": {
"MinimumPasswordLength": "8",
"RequireLowercaseCharacters": "true",
"RequireNumbers": "true",
"RequireUppercaseCharacters": "false",
"AllowUsersToChangePassword": "true",
"RequireSymbols": "false"
},
"previousResourceProperties": null,
"callerCredentials": { },
"platformCredentials": { },
"providerCredentials": { },
"providerLogGroupName": "oc-organizations-passwordpolicy-logs",
"systemTags": {
"aws:cloudformation:stack-name": ,
"aws:cloudformation:stack-id": ,
"aws:cloudformation:logical-id": "PasswordPolicy"
},
"stackTags": null,
"previousStackTags": null
},
"stackId":
}
```

A behavior like this makes a lot harder to develop the resource provider as well as the language plugin itself.

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.