Skip to content
Snippets Groups Projects
Commit 08072180 authored by Ole Voldsæter's avatar Ole Voldsæter
Browse files

fikset feil i cf-template

parent b91839ab
No related branches found
No related tags found
No related merge requests found
...@@ -10,14 +10,10 @@ Parameters: ...@@ -10,14 +10,10 @@ Parameters:
DomainName: DomainName:
Type: String Type: String
Description: The domain name. Description: The domain name.
Default: 'ordbok.aws.uib.no' Default: 'beta.ordbok.aws.uib.no.'
AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-) AllowedPattern: (?!-)[a-zA-Z0-9-.]{1,63}(?<!-)
ConstraintDescription: must be a valid DNS zone name ConstraintDescription: must be a valid DNS zone name
DomainPrefix:
Type: String
Default: beta
PriceClass: PriceClass:
Type: String Type: String
Description: The CloudFront distribution price class Description: The CloudFront distribution price class
...@@ -26,13 +22,16 @@ Parameters: ...@@ -26,13 +22,16 @@ Parameters:
- 'PriceClass_100' - 'PriceClass_100'
#- 'PriceClass_200' #- 'PriceClass_200'
#- 'PriceClass_All' #- 'PriceClass_All'
CertificateArn: CertificateArn:
Type: String Type: String
Default: '' Default: ''
HostedZone:
Type: String
Default: Z2YZQI8X816BZS
############################################################################### ###############################################################################
Resources: Resources:
############################################################################### ###############################################################################
...@@ -40,21 +39,13 @@ Resources: ...@@ -40,21 +39,13 @@ Resources:
DNS: DNS:
Type: "AWS::Route53::RecordSet" Type: "AWS::Route53::RecordSet"
Properties: Properties:
HostedZoneConfig: HostedZoneName: !Ref DomainName
Comment: !Join ['', ['Hosted zone for ', !Ref 'DomainName']] Name: !Ref DomainName
HostedZoneName: !Join ['.', [!Ref DomainName, '']]
Name: !Join ['.', [!Ref DomainPrefix, !Ref DomainName, '']]
Type: A Type: A
AliasTarget: AliasTarget:
HostedZoneId: Z2YZQI8X816BZS HostedZoneId: !Ref HostedZone
DNSName: !GetAtt Distribution.DomainName DNSName: !GetAtt Distribution.DomainName
HostedZoneTags:
- Key: Application
Value: beta.ordbok.uib.no
Tags:
- Key: Application
Value: !Ref DomainName
WebBucket: WebBucket:
Type: "AWS::S3::Bucket" Type: "AWS::S3::Bucket"
Properties: Properties:
...@@ -64,7 +55,7 @@ Resources: ...@@ -64,7 +55,7 @@ Resources:
Tags: Tags:
- Key: Application - Key: Application
Value: !Ref DomainName Value: !Ref DomainName
BucketPolicy: BucketPolicy:
Type: "AWS::S3::BucketPolicy" Type: "AWS::S3::BucketPolicy"
...@@ -79,12 +70,8 @@ Resources: ...@@ -79,12 +70,8 @@ Resources:
Action: s3:GetObject Action: s3:GetObject
Resource: !Join ['', ['arn:aws:s3:::', !Ref 'WebBucket', /*]] Resource: !Join ['', ['arn:aws:s3:::', !Ref 'WebBucket', /*]]
Principal: Principal:
- CanonicalUser: !GetAtt CloudFrontOriginIdentity.S3CanonicalUserId CanonicalUser: !GetAtt CloudFrontOriginIdentity.S3CanonicalUserId
Tags:
- Key: Application
Value: !Ref DomainName
ITAIpSet: ITAIpSet:
Type: "AWS::WAF::IPSet" Type: "AWS::WAF::IPSet"
Properties: Properties:
...@@ -92,10 +79,7 @@ Resources: ...@@ -92,10 +79,7 @@ Resources:
- Type: "IPV4" - Type: "IPV4"
Value: "129.177.0.0/16" Value: "129.177.0.0/16"
Name: "allowed IPs" Name: "allowed IPs"
Tags:
- Key: Application
Value: !Ref DomainName
ITARule: ITARule:
Type: "AWS::WAF::Rule" Type: "AWS::WAF::Rule"
Properties: Properties:
...@@ -105,10 +89,7 @@ Resources: ...@@ -105,10 +89,7 @@ Resources:
- Type: "IPMatch" - Type: "IPMatch"
Negated: false Negated: false
DataId: !Ref ITAIpSet DataId: !Ref ITAIpSet
Tags:
- Key: Application
Value: !Ref DomainName
ACL: ACL:
Type: "AWS::WAF::WebACL" Type: "AWS::WAF::WebACL"
Properties: Properties:
...@@ -121,10 +102,7 @@ Resources: ...@@ -121,10 +102,7 @@ Resources:
Type: "ALLOW" Type: "ALLOW"
Priority: 1 Priority: 1
RuleId: !Ref ITARule RuleId: !Ref ITARule
Tags:
- Key: Application
Value: !Ref DomainName
Distribution: Distribution:
Type: "AWS::CloudFront::Distribution" Type: "AWS::CloudFront::Distribution"
Properties: Properties:
...@@ -139,7 +117,7 @@ Resources: ...@@ -139,7 +117,7 @@ Resources:
S3OriginConfig: S3OriginConfig:
OriginAccessIdentity: !Sub "origin-access-identity/cloudfront/${CloudFrontOriginIdentity}" OriginAccessIdentity: !Sub "origin-access-identity/cloudfront/${CloudFrontOriginIdentity}"
Aliases: Aliases:
- !Join ['.', [!Ref DomainPrefix, !Ref DomainName]] - !Ref DomainName
CustomErrorResponses: CustomErrorResponses:
- ErrorCachingMinTTL: 300 - ErrorCachingMinTTL: 300
ErrorCode: 403 ErrorCode: 403
...@@ -164,9 +142,7 @@ Resources: ...@@ -164,9 +142,7 @@ Resources:
AcmCertificateArn: !Ref CertificateArn AcmCertificateArn: !Ref CertificateArn
MinimumProtocolVersion: TLSv1.1_2016 MinimumProtocolVersion: TLSv1.1_2016
SslSupportMethod: sni-only SslSupportMethod: sni-only
WebACLId: WebACLId: !Ref ACL
- !Ref ACL
- !Ref "AWS::NoValue"
Tags: Tags:
- Key: Application - Key: Application
Value: !Ref DomainName Value: !Ref DomainName
...@@ -176,6 +152,3 @@ Resources: ...@@ -176,6 +152,3 @@ Resources:
Properties: Properties:
CloudFrontOriginAccessIdentityConfig: CloudFrontOriginAccessIdentityConfig:
Comment: "origin identity" Comment: "origin identity"
Tags:
- Key: Application
Value: !Ref DomainName
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment