Skip to content

Commit

Permalink
add parameter to the template file
Browse files Browse the repository at this point in the history
  • Loading branch information
droidkfx committed Dec 28, 2023
1 parent 0e76690 commit 729c273
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions cf/droidkfx.com.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
AWSTemplateFormatVersion: "2010-09-09"
Description: "Droidkfx.com cloudformation template"
Parameters:
DomainName:
Type: String
Description: "Domain name for the website"
AllowedPattern: "(?!-)[A-Za-z0-9-.]{1,63}(?<!-)"
ConstraintDescription: "Must be a valid domain name."
# HostedZoneId:
# Type: String
# Description: "Hosted zone ID for the domain"
# Default: "Z1234567890"
# ConstraintDescription: "Must be a valid hosted zone ID."
Outputs:
InternalWebsiteUrl:
Description: "URL for website"
Value: !GetAtt SiteContentBucket.WebsiteURL
Resources:
SiteContentBucket:
Type: AWS::S3::Bucket
DeletionPolicy: Retain
Properties:
BucketName: "www.droidkfx.com"
BucketName: !Ref DomainName
WebsiteConfiguration:
IndexDocument: index.html
ContentBucketPolicy:
Expand All @@ -16,11 +31,11 @@ Resources:
Statement:
- Action:
- s3:GetObject
- s3:ListBucket
Effect: Allow
Resource: !Join [ '', [ 'arn:aws:s3:::', !Ref SiteContentBucket, '/*' ] ]
Principal:
AWS: 'apigateway.amazonaws.com'
Resource:
- !GetAtt SiteContentBucket.Arn
- !Join [ '/', [ !GetAtt SiteContentBucket.Arn, '*' ] ]
Principal: '*'

# Based on the implementation here: https://cjohansen.no/aws-apigw-proxy-cloudformation/
GatewayApi:
Expand Down

0 comments on commit 729c273

Please sign in to comment.