Skip to content

updated outputs to include API GW URL. Modified CloudFormation to all… #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const AWS = require('aws-sdk');
const axios = require('axios');
const axios = require('./node_modules/axios');
const s3 = new AWS.S3();
const crypto = require('crypto');

Expand Down
24 changes: 16 additions & 8 deletions infra/Infra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,34 @@ Parameters:
- API Gateway
- Application Load Balancer
LBCIDR:
Default: ''
Type: String
Description: CIDR allowed to communicate with the Load Balancer. It should allow the Bitbucket server IP address. Leave it blank if you are using the API Gateway endpoint type.
LBSubnets:
Type: List<AWS::EC2::Subnet::Id>
Default: ''
Type: String
Description: Subnets where the Application Load Balancer run. Leave it blank if you are using the API Gateway endpoint type.
LBSSLCertificateArn:
Default: ''
Type: String
Description: SSL Certificate to associate with the Application Load Balancer. Leave it blank if you are using the API Gateway endpoint type.
LambdaSubnets:
Type: List<AWS::EC2::Subnet::Id>
Type: String
Description: Subnets where the Lambda Function run
S3BucketCodePipelineName:
Type: String
Description: S3 bucket name to store the Bitbucket repository content
AllowedPattern: '^[a-z]*$'
ConstraintDescription: This field should contain only lower case characters
AllowedPattern: ^[0-9a-z]+([0-9a-z-]*[0-9a-z])*$
ConstraintDescription: This field should contain only lower case characters, numbers, and hyphens
VPCID:
Type: AWS::EC2::VPC::Id
Description: VPC ID where the Application Load Balancer and the Lambda function run
WebProxyHost:
Default: ''
Type: String
Description: Hostname of your Proxy server used by the Lambda Function to access the Bitbucket server. If you don't need a web proxy leave it blank. e.g. myproxy.mydomain.com
WebProxyPort:
Default: ''
Type: String
Description: Port of your Proxy server used by the Lambda Function to access the Bitbucket server. If you don't need a web proxy leave it blank. e.g. 8080

Expand Down Expand Up @@ -164,7 +169,7 @@ Resources:
VpcConfig:
SecurityGroupIds:
- Ref: SgLambdaFunction
SubnetIds: !Ref LambdaSubnets
SubnetIds: !Split [ ',', !Ref LambdaSubnets ]

LambdaPermissionAlb:
Type: AWS::Lambda::Permission
Expand Down Expand Up @@ -192,7 +197,7 @@ Resources:
Scheme: internet-facing
SecurityGroups:
- Ref: SgAlb
Subnets: !Ref LBSubnets
Subnets: !Split [ ',', !Ref LBSubnets ]
IpAddressType: ipv4

AlbListener443:
Expand All @@ -213,7 +218,7 @@ Resources:

TargetGroup:
DependsOn: LambdaPermissionAlb
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Type: AWS::ElasticLoadBalancingV2::TargetGroup
Condition: EndpointTypeALB
Properties:
TargetType: lambda
Expand Down Expand Up @@ -261,4 +266,7 @@ Outputs:
Value:
Fn::GetAtt:
- Alb
- DNSName
- DNSName
EndpointUrlAPIGW:
Condition: EndpointTypeAPIGW
Value: !Sub "https://${RestApi}.execute-api.${AWS::Region}.amazonaws.com/prod/"