Skip to content

Commit

Permalink
cfn-lint, Cloudfront cname support etc... (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
BastLeblanc authored Nov 20, 2023
1 parent f40040a commit 746bb2b
Show file tree
Hide file tree
Showing 14 changed files with 128 additions and 226 deletions.
2 changes: 2 additions & 0 deletions .cfnlintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ templates:
- aws/cloudformation-templates/event-engine/*.yaml
- aws/cloudformation-templates/services/*.yaml
- aws/cloudformation-templates/services/service/*.yaml
ignore_checks:
- I3011 #demo site,
55 changes: 0 additions & 55 deletions aws/cloudformation-templates/base/_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,57 +102,6 @@ Parameters:
Type: String
Description: The GitHub branch used for deployment.

FenixZipDetectUrl:
Type: String
Description: Fenix Commerce Zipcode Detect URL
Default: "https://ipapi.co/json?key=cKGC3jQbSIoXYmI2KtXObugsKfosD9Yr0HnkHhPUu1SM2wQhE0"

FenixTenantId:
Type: String
Description: Fenix Commerce Demo Env TenantID
Default: "ec6ea3439489426ba09cf6c906ead8d5"
NoEcho: true

FenixEddEndpoint:
Type: String
Description: Fenix Commerce Estimated Delivery Date Endpoint URL
Default: "https://awsretaildemo.delest.fenixcommerce.com/fenixdelest/api/v2/deliveryestimates"

FenixMonetaryValue:
Type: String
Description: Fenix Commerce Default monetary value to control free shipping above $100 default for demo
Default: 100

FenixEnabledPdp:
Type: String
Description: Fenix Commerce Flag to enable EDD on PDP
AllowedValues:
- "TRUE"
- "FALSE"
Default: "TRUE"

FenixEnabledCart:
Type: String
Description: Fenix Commerce Flag to enable EDD on CART
AllowedValues:
- "TRUE"
- "FALSE"
Default: "TRUE"

FenixEnabledCheckout:
Type: String
Description: Fenix Commerce Flag to enable EDD on checkout
AllowedValues:
- "TRUE"
- "FALSE"
Default: "TRUE"

FenixXapiKey:
Type: String
Description: Fenix Commerce Demo Env x-api-key
Default: "nr50Qdu7FM94n2X1GYuhA8cFzyvdYTJ5Qka4XMOd"
NoEcho: true

ACMCertificateArn:
Type: String
Description: ACM Certificate ARN for CloudFront WebUICDN
Expand Down Expand Up @@ -185,9 +134,7 @@ Resources:
ResourceBucket: !Ref ResourceBucket
ResourceBucketRelativePath: !Ref ResourceBucketRelativePath
VpcId: !GetAtt VPC.Outputs.VpcId
Subnets: !GetAtt VPC.Outputs.Subnets
Subnet1: !GetAtt VPC.Outputs.Subnet1
Subnet2: !GetAtt VPC.Outputs.Subnet2
ExperimentStrategyTable: !GetAtt Tables.Outputs.ExperimentStrategyTable
StackBucketName: !GetAtt Buckets.Outputs.StackBucketName
Uid: !Sub ${ParentStackName}-${AWS::Region}
Expand Down Expand Up @@ -266,9 +213,7 @@ Resources:
TemplateURL: !Sub https://s3.amazonaws.com/${ResourceBucket}/${ResourceBucketRelativePath}cloudformation-templates/base/opensearch.yaml
Parameters:
VpcId: !GetAtt VPC.Outputs.VpcId
Subnets: !GetAtt VPC.Outputs.Subnets
Subnet1: !GetAtt VPC.Outputs.Subnet1
Subnet2: !GetAtt VPC.Outputs.Subnet2

# SSM Parameters
SSMParameters:
Expand Down
8 changes: 4 additions & 4 deletions aws/cloudformation-templates/base/cloudfront.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Resources:
- Sid: 'AllowCloudFrontServicePrincipalReadOnly'
Action: 's3:GetObject'
Effect: Allow
Resource: !Sub 'arn:aws:s3:::${WebUIBucket}/*'
Resource: !Sub 'arn:${AWS::Partition}:s3:::${WebUIBucket}/*'
Principal:
Service: 'cloudfront.amazonaws.com'
Condition:
StringEquals:
AWS:SourceArn: !Sub 'arn:aws:cloudfront::${AWS::AccountId}:distribution/${WebUICDN}'
AWS:SourceArn: !Sub 'arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:distribution/${WebUICDN}'

UIOriginAccessControl:
Type: AWS::CloudFront::OriginAccessControl
Expand Down Expand Up @@ -161,12 +161,12 @@ Resources:
Statement:
- Action: 's3:GetObject'
Effect: Allow
Resource: !Sub 'arn:aws:s3:::${SwaggerUIBucket}/*'
Resource: !Sub 'arn:${AWS::Partition}:s3:::${SwaggerUIBucket}/*'
Principal:
Service: 'cloudfront.amazonaws.com'
Condition:
StringEquals:
AWS:SourceArn: !Sub 'arn:aws:cloudfront::${AWS::AccountId}:distribution/${SwaggerUICDN}'
AWS:SourceArn: !Sub 'arn:${AWS::Partition}:cloudfront::${AWS::AccountId}:distribution/${SwaggerUICDN}'

SwaggerUICDN:
Type: 'AWS::CloudFront::Distribution'
Expand Down
6 changes: 0 additions & 6 deletions aws/cloudformation-templates/base/notebook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ Parameters:
Type: String
Description: The GitHub branch to use for deployments.

Subnets:
Type: String

Subnet1:
Type: String

Subnet2:
Type: String

VpcId:
Type: String

Expand Down
6 changes: 0 additions & 6 deletions aws/cloudformation-templates/base/opensearch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@ Description: >
Parameters:

Subnets:
Type: String

Subnet1:
Type: String

Subnet2:
Type: String

VpcId:
Type: String

Expand Down
8 changes: 4 additions & 4 deletions aws/cloudformation-templates/location.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Resources:
Code:
S3Bucket: !Ref ResourceBucket
S3Key: !Sub '${ResourceBucketRelativePath}aws-lambda/location-resource-stack.zip'
Runtime: python3.8
Runtime: python3.10
Timeout: 900
FunctionName: LocationNrfDemoLocationResourceStack
Environment:
Expand Down Expand Up @@ -275,7 +275,7 @@ Resources:
Code:
S3Bucket: !Ref ResourceBucket
S3Key: !Sub '${ResourceBucketRelativePath}aws-lambda/location-geofence-event.zip'
Runtime: python3.8
Runtime: python3.10
Timeout: 900
VpcConfig:
SecurityGroupIds:
Expand Down Expand Up @@ -460,7 +460,7 @@ Resources:
Code:
S3Bucket: !Ref ResourceBucket
S3Key: !Sub '${ResourceBucketRelativePath}aws-lambda/websocket-connect.zip'
Runtime: python3.8
Runtime: python3.10
Timeout: 30
FunctionName: LocationNrfDemoNotificationApiConnect
Environment:
Expand Down Expand Up @@ -523,7 +523,7 @@ Resources:
Code:
S3Bucket: !Ref ResourceBucket
S3Key: !Sub '${ResourceBucketRelativePath}aws-lambda/websocket-disconnect.zip'
Runtime: python3.8
Runtime: python3.10
Timeout: 30
FunctionName: LocationNrfDemoNotificationApiDisconnect
Environment:
Expand Down
29 changes: 2 additions & 27 deletions aws/cloudformation-templates/services/_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ Parameters:

IdentityPoolId:
Type: String

StackBucketName:
Type: String


Subnets:
Type: String

Expand Down Expand Up @@ -132,10 +129,6 @@ Parameters:
Type: String
Description: Whether to use created IVS streams or those hosted by AWS.

ParentStackName:
Type: String
Description: Parent stack name

EvidentlyProjectName:
Type: String
Description: Evidently project name
Expand Down Expand Up @@ -166,7 +159,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -182,7 +174,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -203,7 +194,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -217,7 +207,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -238,7 +227,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -254,7 +242,6 @@ Resources:
CartsTable: !Ref CartsTable
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -275,7 +262,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -289,7 +275,6 @@ Resources:
OrdersTable: !Ref OrdersTable
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -310,7 +295,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -324,7 +308,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -345,7 +328,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -359,7 +341,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -380,7 +361,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -394,7 +374,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -415,7 +394,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -431,7 +409,6 @@ Resources:
DeleteRepositoryLambdaArn: !GetAtt DeleteRepositoryLambdaFunction.Arn
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -452,7 +429,6 @@ Resources:
UserPoolId: !Ref UserPoolId
UserPoolClientId: !Ref UserPoolClientId
IdentityPoolId: !Ref IdentityPoolId
StackBucketName: !Ref StackBucketName
Subnets: !Ref Subnets
VpcId: !Ref VpcId
VpcCidr: !Ref VpcCidr
Expand All @@ -467,7 +443,6 @@ Resources:
UseDefaultIVSStreams: !If [UseDefaultIVSStreams, true, false]
WebRootUrl: !Ref WebRootUrl
ImageRootUrl: !Ref ImageRootUrl
Uid: !Sub ${ParentStackName}-${AWS::Region}
EvidentlyProjectName: !Ref EvidentlyProjectName
LoggingBucketName: !Ref LoggingBucketName

Expand All @@ -483,7 +458,7 @@ Resources:
RecommendationsServiceDNSName: !GetAtt RecommendationsService.Outputs.ServiceDNSName
OffersServiceDNSName: !GetAtt OffersService.Outputs.ServiceDNSName
PinpointAppId: !Ref PinpointAppId
Uid: !Sub ${ParentStackName}-${AWS::Region}
Uid: !Sub ${AWS::StackName}-${AWS::Region}
LambdaVpcSecurityGroup: !Ref LambdaVpcSecurityGroup
LambdaVpcSubnets: !Ref Subnets

Expand Down
Loading

0 comments on commit 746bb2b

Please sign in to comment.