Skip to content

Commit

Permalink
Merge pull request #82 from aws-samples/removing-stackname-dependencies
Browse files Browse the repository at this point in the history
removed stack name dependency and replaced with unique ID segment fro…
  • Loading branch information
JoseRolles authored Aug 26, 2024
2 parents 48b99bd + 7759a6a commit 991a50b
Showing 1 changed file with 91 additions and 7 deletions.
98 changes: 91 additions & 7 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,19 @@ Resources:
- AWSMarketplaceMeteringRecords
- AWSMarketplaceSubscribers
Properties:
RoleName: !Join ["-", [!Ref "AWS::StackName", !Ref CrossAccountRoleName]]
RoleName:
!Join
- '-'
- - 'CrossAccountRoleName'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
Expand All @@ -137,7 +149,19 @@ Resources:
'sts:ExternalId': !Ref CrossAccountRoleName
Path: /
Policies:
- PolicyName: !Join ["-", [!Ref "AWS::StackName", "CrossAccountPolicy"]]
- PolicyName:
!Join
- '-'
- - 'CrossAccountPolicy'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
PolicyDocument:
Version: 2012-10-17
Statement:
Expand Down Expand Up @@ -355,14 +379,38 @@ Resources:
Type: Schedule
Properties:
Schedule: "rate(1 hour)"
Name: !Join ["-", [MeteringSchedule, !Ref AWS::StackName]]
Name:
!Join
- '-'
- - 'MeteringSchedule'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
Description: SaaS Metering
Enabled: true

SQSMeteringRecords:
Type: AWS::SQS::Queue
Properties:
QueueName: !Join ["-", [!Ref AWS::StackName, SQSMeteringRecords.fifo]]
QueueName:
!Join
- '-'
- - !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
- 'SQSMeteringRecords.fifo'
ContentBasedDeduplication: true
FifoQueue: true
MessageRetentionPeriod: 3000
Expand Down Expand Up @@ -472,8 +520,32 @@ Resources:
Type: "AWS::CloudFront::OriginAccessControl"
Properties:
OriginAccessControlConfig:
Description: !Sub "Origin Access Control for static website - ${AWS::StackName}"
Name: !Sub "OAC - ${AWS::StackName}"
Description:
!Join
- '-'
- - 'Origin Access Control for static website'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
Name:
!Join
- '-'
- - 'OAC'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
OriginAccessControlOriginType: "s3"
SigningBehavior: "always"
SigningProtocol: "sigv4"
Expand All @@ -485,7 +557,19 @@ Resources:
DependsOn: ServerlessApi
Properties:
DistributionConfig:
Comment: !Sub "Cloudfront distribution for serverless website - ${AWS::StackName}"
Comment:
!Join
- '-'
- - 'Cloudfront distribution for serverless website'
- !Select
- 0
- !Split
- "-"
- !Select
- 2
- !Split
- "/"
- !Ref AWS::StackId
DefaultRootObject: "index.html"
Enabled: true
HttpVersion: http2
Expand Down

0 comments on commit 991a50b

Please sign in to comment.