aws-cloudformation / cloudformation-resource-schema

The CloudFormation Resource Schema defines the shape and semantic for resources provisioned by CloudFormation. It is used by provider developers using the CloudFormation RPDK.
Apache License 2.0
95 stars 38 forks source link

Specify properties for serialized behavior #79

Open benkehoe opened 4 years ago

benkehoe commented 4 years ago

I'd like to create an AWS::S3::BucketNotification resource to fix a longstanding problem in CloudFormation. And when I do, I'd like to enable individual notification configuration items to be managed separately. But because the API only supports updating the entire notification configuration, I need to serialize access to the notification configuration for a given bucket. I plan to do with a resource provider that relies on a user-account-side mechanism involving an SQS FIFO queue. It would be great if, in my schema, I could specify a property or set of properties that would cause all resources with the same values for those properties to have their requests serialized (but resources with different values for those properties could be processed in parallel).

rjlohan commented 4 years ago

I like this concept, it's going to take some thinking on how to support this in the service.

benkehoe commented 4 years ago

Another use case is that the CloudFormation type registry only allows one in-flight operation at a time on a given type. So if I have multiple AWS::CloudFormation::ResourceVersion resources with the same TypeName, I need to manually serialize those resources using DependsOn (example).

benbridts commented 4 years ago

Adding DynamoDB tables as a use case (from the docs):

AWS CloudFormation typically creates DynamoDB tables in parallel. However, if your template includes multiple DynamoDB tables with indexes, you must declare dependencies so that the tables are created sequentially. Amazon DynamoDB limits the number of tables with secondary indexes that are in the creating state. If you create multiple tables with indexes at the same time, DynamoDB returns an error and the stack operation fails.

benkehoe commented 4 years ago

Adding DynamoDB tables as a use case

This might be a separate request, as it is a global concurrency limit (possibly soft), rather than a strict serialization based on the value of a property or set of properties. I'm tempted to say such a concurrency limit belongs in the registry API rather than the schema.

benbridts commented 4 years ago

This might be a separate request

You're right. In cases where ordering doesn't matter Concurrency: 1 could also solve the serialization (if it can be currently solved with DependsOn).

@rjlohan If i create a new ticket for that, should it go in the Coverage Roadmap?

rjlohan commented 4 years ago

This might be a separate request

You're right. In cases where ordering doesn't matter Concurrency: 1 could also solve the serialization (if it can be currently solved with DependsOn).

@rjlohan If i create a new ticket for that, should it go in the Coverage Roadmap?

Yeah put it there. It'll require at least some service side changes to understand the directive whether it comes from template or type schemas.