Skip to content

Commit

Permalink
fix(collection): append additional bucket and topic sources
Browse files Browse the repository at this point in the history
A user may specify additional S3 buckets and SNS topics to be able to
subscribe to. Append them to the S3 bucket and SNS topic created in our
collection stack.

Sadly, cloudformation makes it shockingly convoluted to append a string
to a list.
  • Loading branch information
jta committed Oct 4, 2023
1 parent 80511dc commit 1c45353
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions apps/collection/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Metadata:
default: Required parameters
Parameters:
- DataAccessPointArn
- DestinationArn
- DestinationUri
- Label:
default: Components
Parameters:
Expand Down Expand Up @@ -74,6 +74,12 @@ Conditions:
UseStackName: !Equals
- !Ref NameOverride
- ""
EmptySourceBucketNames: !Equals
- !Join [ ",", !Ref SourceBucketNames ]
- ""
EmptySourceTopicArns: !Equals
- !Join [ ",", !Ref SourceTopicArns ]
- ""

Resources:
Topic:
Expand Down Expand Up @@ -140,8 +146,22 @@ Resources:
Parameters:
DataAccessPointArn: !Ref DataAccessPointArn
DestinationUri: !Ref DestinationUri
SourceBucketNames: !Ref Bucket
SourceTopicArns: !Ref Topic
SourceBucketNames: !If
- EmptySourceBucketNames
- [ !Ref Bucket ]
- !Split
- ","
- !Sub
- "${Bucket},${buckets}"
- buckets: !Join [ ",", !Ref SourceBucketNames ]
SourceTopicArns: !If
- EmptySourceTopicArns
- [ !Ref Topic ]
- !Split
- ","
- !Sub
- "${Topic},${topics}"
- topics: !Join [ ",", !Ref SourceTopicArns ]
NameOverride: !If
- UseStackName
- !Ref 'AWS::StackName'
Expand Down

0 comments on commit 1c45353

Please sign in to comment.