Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
Merged up to plugin restruct
Browse files Browse the repository at this point in the history
  • Loading branch information
wizage committed Sep 26, 2019
2 parents 5912d08 + 551a212 commit b7ce496
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Description: CloudFront Distribution for output bucket

Parameters:
pBucketName:
Type: String
Description: ProjectName
AllowedPattern: "[a-zA-Z][a-zA-Z0-9-_]*"
Default: DefaultName
pOriginAccessIdentity:
Type: String
Description: Policy for bucket
Default: NA

Resources:
rCloudFrontDist:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
Origins:
-
DomainName:
- !Join
- '.'
- - !Ref pBucketName
- 's3.amazonaws.com'
Id: vodS3Origin
S3OriginConfig:
OriginAccessIdentity: origin-access-identity/cloudfront/
Enabled: 'true'
PriceClass: PriceClass_All
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,46 @@ Parameters:
Description: ProjectName
AllowedPattern: "[a-zA-Z][a-zA-Z0-9-_]*"
Default: DefaultName
pCloudfrontEnabled:
Type: String
Description: Check if CF is enabled
Default: "False"

Condition:
CreateCloudfront: [!Equals [!Ref pCloudfrontEnabled, "True"]]

Resources:
OutputBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: !Ref pBucketName

OriginAccessIdentity:
Type: "AWS::CloudFront::CloudFrontOriginAccessIdentity"
Condition: CreateCloudfront
Properties:
CloudFrontOriginAccessIdentityConfig:
Comment: !Sub "OAI created by ${AWS::StackName} in ${AWS::Region}"

S3Policy:
Type: AWS::S3::BucketPolicy
Condition: CreateCloudfront
Properties:
- Action:
- "s3:getObject"
Effect: Allow
Resource: !Sub "arn:aws:s3:::${OutputBucket}/*"
Principal:
AWS: !Sub "arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity ${OriginAccessIdentity}"

Outputs:
oOutputBucketArn:
Value: !GetAtt OutputBucket.Arn
Description: BucketArn
oOutputBucketName:
Value: !Ref OutputBucket
Description: S3 Bucket Created
Description: S3 Bucket Created
oOriginAccessIdentity:
Condition: CreateCloudfront
Value: !Ref OriginAccessIdentity
Description: Origin Access Identity for Cloudfront
2 changes: 1 addition & 1 deletion provider-utils/livestream-questions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"question": "Provide a friendly name for your resource to be used as a label for this category in the project:",
"validation": {
"operator": "regex",
"value": "^[a-zA-Z0-9]+$",
"value": "^[a-zA-Z0-9\\-]+$",
"onErrorMsg": "Resource name should be alphanumeric"
},
"required": true
Expand Down
2 changes: 1 addition & 1 deletion provider-utils/vod-questions.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"question": "Provide a friendly name for your resource to be used as a label for this category in the project:",
"validation": {
"operator": "regex",
"value": "^[a-zA-Z0-9]+$",
"value": "^[a-zA-Z0-9\\-]+$",
"onErrorMsg": "Resource name should be alphanumeric"
},
"required": true
Expand Down

0 comments on commit b7ce496

Please sign in to comment.