-
Notifications
You must be signed in to change notification settings - Fork 1
/
final-cicd-ags-alb-template.yaml
753 lines (707 loc) · 21.5 KB
/
final-cicd-ags-alb-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
AWSTemplateFormatVersion: 2010-09-09
Description: Template for deploying dotnet app (cicd)
Parameters:
VpcCIDR:
Description: Please enter the IP range (CIDR notation) for this VPC
Type: String
Default: 10.192.0.0/16
PublicSubnet1CIDR:
Description: Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone
Type: String
Default: 10.192.10.0/24
PublicSubnet2CIDR:
Description: Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone
Type: String
Default: 10.192.11.0/24
PublicSubnet3CIDR:
Description: Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone
Type: String
Default: 10.192.12.0/24
Token:
Type: String
Description: Github token.
MyPublicIP:
Type: String
Description: My own public IP.
Default: 86.236.61.199/32
MyKeyName:
Type: String
Description: My own key name.
Default: pcourt-01
Env:
Type: String
Description: ...
Default: prod
DbUser:
Type: String
Description: ...
Default: admin
DbPassword:
Type: String
Description: ...
Default: Coucou123!
BranchRepo:
Type: String
Description: ...
Default: master
GitRepo:
Type: String
Description: ...
Default: ChoixSejour
GithubUser:
Type: String
Description: ...
Default: Piercuta
ApplicationName:
Type: String
Description: ...
Default: choixsejour
DllToStart:
Type: String
Description: ...
Default: ChoixSejour.dll
Client:
Type: String
Description: ...
Default: piercuta
CertificateArn:
Type: String
Description: ...
Default: arn:aws:acm:eu-west-1:647408608766:certificate/a5b6add8-26ef-4a5b-95c1-0469f2a2f82d
Resources:
# Network
VPC:
Type: AWS::EC2::VPC
Properties:
CidrBlock: !Ref VpcCIDR
EnableDnsSupport: true
EnableDnsHostnames: true
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-vpc
- Key: env
Value: !Ref Env
InternetGateway:
Type: AWS::EC2::InternetGateway
Properties:
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-igw
- Key: env
Value: !Ref Env
InternetGatewayAttachment:
Type: AWS::EC2::VPCGatewayAttachment
Properties:
InternetGatewayId: !Ref InternetGateway
VpcId: !Ref VPC
PublicSubnet1:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 0, !GetAZs '' ]
CidrBlock: !Ref PublicSubnet1CIDR
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-public-subnet-az1
- Key: env
Value: !Ref Env
PublicSubnet2:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 1, !GetAZs '' ]
CidrBlock: !Ref PublicSubnet2CIDR
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-public-subnet-az2
- Key: env
Value: !Ref Env
PublicSubnet3:
Type: AWS::EC2::Subnet
Properties:
VpcId: !Ref VPC
AvailabilityZone: !Select [ 2, !GetAZs '' ]
CidrBlock: !Ref PublicSubnet3CIDR
MapPublicIpOnLaunch: true
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-public-subnet-az3
- Key: env
Value: !Ref Env
PublicRouteTable:
Type: AWS::EC2::RouteTable
Properties:
VpcId: !Ref VPC
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-public-route
- Key: env
Value: !Ref Env
DefaultPublicRoute:
Type: AWS::EC2::Route
DependsOn: InternetGatewayAttachment
Properties:
RouteTableId: !Ref PublicRouteTable
DestinationCidrBlock: 0.0.0.0/0
GatewayId: !Ref InternetGateway
PublicSubnet1RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet1
PublicSubnet2RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet2
PublicSubnet3RouteTableAssociation:
Type: AWS::EC2::SubnetRouteTableAssociation
Properties:
RouteTableId: !Ref PublicRouteTable
SubnetId: !Ref PublicSubnet3
# Database
InstanceSubnetGroup:
Type: AWS::RDS::DBSubnetGroup
Properties:
DBSubnetGroupDescription: subnet group for instance mysql
DBSubnetGroupName: !Sub ${Client}-${Env}-${ApplicationName}-rds-subnet-group
SubnetIds:
- !Ref PublicSubnet1
- !Ref PublicSubnet2
- !Ref PublicSubnet3
Tags:
- Key: env
Value: !Ref Env
RDSSecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupName: !Sub ${Client}-${Env}-${ApplicationName}-rds-sg
VpcId: !Ref VPC
GroupDescription: SecurityGroup for RDS instance.
SecurityGroupIngress:
- SourceSecurityGroupId: !GetAtt EC2SecurityGroup.GroupId
FromPort: '3306'
ToPort: '3306'
IpProtocol: tcp
- CidrIp: !Ref MyPublicIP
IpProtocol: tcp
FromPort: '3306'
ToPort: '3306'
Tags:
- Key: env
Value: !Ref Env
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-rds-sg
RDSInstance:
Type: 'AWS::RDS::DBInstance'
DeletionPolicy: Delete
Properties:
MasterUserPassword: !Ref DbPassword
DBInstanceClass: db.t2.micro
DBSubnetGroupName: !Ref InstanceSubnetGroup
VPCSecurityGroups:
- !Ref RDSSecurityGroup
MasterUsername: !Ref DbUser
DBInstanceIdentifier: !Sub ${Client}-${Env}-${ApplicationName}-db-mysql
MultiAZ: false
PubliclyAccessible: true
Engine: mysql
AllocatedStorage: 5
Tags:
- Key: env
Value: !Ref Env
# Application
EC2SecurityGroup:
Type: 'AWS::EC2::SecurityGroup'
Properties:
GroupName: !Sub ${Client}-${Env}-${ApplicationName}-ec2-sg
VpcId: !Ref VPC
GroupDescription: SecurityGroup for EC2 instance.
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
FromPort: '22'
ToPort: '22'
IpProtocol: tcp
- CidrIp: 0.0.0.0/0
FromPort: '5000'
ToPort: '5000'
IpProtocol: tcp
- CidrIp: 0.0.0.0/0
FromPort: '5001'
ToPort: '5001'
IpProtocol: tcp
Tags:
- Key: env
Value: !Ref Env
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-ec2-sg
EC2InstanceProfile:
Type: 'AWS::IAM::InstanceProfile'
Properties:
Path: /
Roles:
- !Ref EC2InstanceRole
EC2InstanceRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub ${Client}-${Env}-${ApplicationName}-instance-role
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- ec2.amazonaws.com
Action:
- 'sts:AssumeRole'
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/service-role/AmazonEC2RoleforSSM'
- 'arn:aws:iam::aws:policy/AdministratorAccess'
Path: /
Tags:
- Key: Name
Value: !Sub ${Env}-instance-role
- Key: env
Value: !Ref Env
ALBSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupName: !Sub ${Client}-${Env}-${ApplicationName}-alb-sg
GroupDescription: "Security group for alb"
VpcId: !Ref VPC
SecurityGroupIngress:
- CidrIp: 0.0.0.0/0
IpProtocol: tcp
FromPort: '80'
ToPort: '80'
- CidrIp: 0.0.0.0/0
IpProtocol: tcp
FromPort: '443'
ToPort: '443'
Tags:
- Key: env
Value: !Ref Env
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-alb-sg
ApplicationLoadBalancer:
Type: 'AWS::ElasticLoadBalancingV2::LoadBalancer'
Properties:
Name: !Sub ${Client}-${Env}-${ApplicationName}-alb
SecurityGroups:
- !Ref ALBSecurityGroup
Subnets:
- !Ref PublicSubnet1
- !Ref PublicSubnet2
- !Ref PublicSubnet3
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-alb
- Key: env
Value: !Ref Env
ALBListener80:
Type: "AWS::ElasticLoadBalancingV2::Listener"
Properties:
DefaultActions:
- Type: "redirect"
RedirectConfig:
Protocol: "HTTPS"
Port: 443
Host: "#{host}"
Path: "/#{path}"
Query: "#{query}"
StatusCode: "HTTP_301"
LoadBalancerArn: !Ref ApplicationLoadBalancer
Port: 80
Protocol: "HTTP"
ALBListener443:
Type: 'AWS::ElasticLoadBalancingV2::Listener'
Properties:
DefaultActions:
- Type: forward
ForwardConfig:
TargetGroups:
- TargetGroupArn: !Ref ALBTargetGroup5001
Weight: 1
- TargetGroupArn: !Ref ALBTargetGroup5000
Weight: 1
TargetGroupStickinessConfig:
DurationSeconds: 300
Enabled: true
# For having only one target group
# TargetGroupArn: !Ref ALBTargetGroup5001
LoadBalancerArn: !Ref ApplicationLoadBalancer
Port: '443'
Protocol: HTTPS
Certificates:
- CertificateArn: !Ref CertificateArn
ALBTargetGroup5000:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: !Sub ${Client}-${Env}-${ApplicationName}-tg-5000
HealthCheckPath: /
HealthCheckIntervalSeconds: 10
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
Port: 5000
Protocol: HTTP
UnhealthyThresholdCount: 5
VpcId: !Ref VPC
TargetGroupAttributes:
- Key: stickiness.enabled
Value: 'true'
- Key: stickiness.type
Value: lb_cookie
- Key: stickiness.lb_cookie.duration_seconds
Value: '30'
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-tg-5000
- Key: env
Value: !Ref Env
ALBTargetGroup5001:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: !Sub ${Client}-${Env}-${ApplicationName}-tg-5001
HealthCheckPath: /
HealthCheckIntervalSeconds: 10
HealthCheckTimeoutSeconds: 5
HealthyThresholdCount: 2
Port: 5001
Protocol: HTTP
UnhealthyThresholdCount: 5
VpcId: !Ref VPC
TargetGroupAttributes:
- Key: stickiness.enabled
Value: 'true'
- Key: stickiness.type
Value: lb_cookie
- Key: stickiness.lb_cookie.duration_seconds
Value: '30'
Tags:
- Key: Name
Value: !Sub ${Client}-${Env}-${ApplicationName}-tg-5001
- Key: env
Value: !Ref Env
AutoScalingGroup:
Type: 'AWS::AutoScaling::AutoScalingGroup'
DependsOn:
- RDSInstance
Properties:
AutoScalingGroupName: !Sub ${Client}-${Env}-${ApplicationName}-asg
VPCZoneIdentifier:
- !Ref PublicSubnet1
- !Ref PublicSubnet2
- !Ref PublicSubnet3
LaunchTemplate:
LaunchTemplateId: !Ref AutoScalingLaunchTemplate
Version: !GetAtt
- AutoScalingLaunchTemplate
- LatestVersionNumber
MinSize: '1'
MaxSize: '2'
DesiredCapacity: '1'
HealthCheckType: ELB
HealthCheckGracePeriod: '300'
TargetGroupARNs:
- !Ref ALBTargetGroup5000
- !Ref ALBTargetGroup5001
Tags:
- Key: Name
PropagateAtLaunch: true
Value: !Sub ${Client}-${Env}-${ApplicationName}-instance
- Key: app
PropagateAtLaunch: true
Value: !Ref ApplicationName
- Key: env
PropagateAtLaunch: true
Value: !Ref Env
- Key: deploy
PropagateAtLaunch: true
Value: !Sub ${Client}-${Env}-${ApplicationName}-deploy
AutoScalingLaunchTemplate:
Type: 'AWS::EC2::LaunchTemplate'
DependsOn:
- EC2InstanceProfile
Properties:
LaunchTemplateName: !Sub ${Client}-${Env}-${ApplicationName}-lt
LaunchTemplateData:
ImageId: ami-04dd4500af104442f
InstanceType: t2.micro
IamInstanceProfile:
Name: !Ref EC2InstanceProfile
NetworkInterfaces:
- AssociatePublicIpAddress: 'true'
DeviceIndex: 0
Groups:
- !Ref EC2SecurityGroup
KeyName: !Ref MyKeyName
BlockDeviceMappings:
- DeviceName: /dev/xvda
Ebs:
VolumeSize: 60
VolumeType: gp2
UserData:
Fn::Base64: !Sub |
#!/bin/bash -xe
echo "START user data instructions"
cd /tmp/
curl https://download.visualstudio.microsoft.com/download/pr/3c98126b-50f5-4497-8ffd-18d17a3f6b95/044d0f20256fd9bf2971f8da9a0364e4/dotnet-sdk-3.1.416-linux-x64.tar.gz --output dotnet-sdk-3.1.416-linux-x64.tar.gz
DOTNET_FILE=dotnet-sdk-3.1.416-linux-x64.tar.gz
export DOTNET_ROOT=/tmp/dotnet
mkdir -p "$DOTNET_ROOT" && tar zxf "$DOTNET_FILE" -C "$DOTNET_ROOT"
echo ${Env} > env.txt
echo ${ApplicationName} > application_name.txt
echo ${DllToStart} > dll_to_start.txt
cd ..
yum install -y ruby
cd /home/ec2-user/
wget 'https://aws-codedeploy-eu-west-1.s3.eu-west-1.amazonaws.com/latest/install'
chmod +x ./install
sudo ./install auto
echo "END user data instructions"
# sudo -i
# echo export DB_PASSWORD=my_password >> /etc/profile
# echo "export PATH=$PATH:/tmp/dotnet" >> /etc/profile
# export DOTNET_ROOT=$(pwd)/dotnet
# export PATH=$PATH:$DOTNET_ROOT
# export PATH=$PATH:/tmp/dotnet
# cd ~/
# sed 's|bin|bin:$HOME\/.dotnet|g' .bash_profile
# echo "export DOTNET_ROOT=\$HOME/.dotnet" >> .bash_profile
TagSpecifications:
- ResourceType: volume
Tags:
- Key: env
Value: !Ref Env
# AppNameParamStore:
# Type: AWS::SSM::Parameter
# Properties:
# Name: !Sub ${Client}-${Env}-${ApplicationName}
# Type: String
# Value: !Ref ApplicationName
# Description: SSM Parameter for code deploy.
# DllToStartParamStore:
# Type: AWS::SSM::Parameter
# Properties:
# Name: !Sub ${Client}-${Env}-${ApplicationName}-dll-to-start
# Type: String
# Value: !Ref DllToStart
# Description: SSM Parameter for code deploy.
# CICD
DeployApplication:
Type: 'AWS::CodeDeploy::Application'
Properties:
ApplicationName: !Sub ${Client}-${Env}-${ApplicationName}-app
ComputePlatform: Server
Tags:
- Key: env
Value: !Ref Env
DeploymentGroup:
Type: 'AWS::CodeDeploy::DeploymentGroup'
Properties:
ApplicationName: !Ref DeployApplication
Ec2TagFilters:
- Key: deploy
Type: KEY_AND_VALUE
Value: !Sub ${Client}-${Env}-${ApplicationName}-deploy
ServiceRoleArn: !GetAtt
- CodeDeployDGRole
- Arn
AutoScalingGroups:
- Ref: AutoScalingGroup
LoadBalancerInfo:
TargetGroupInfoList:
- Name: !GetAtt ALBTargetGroup5000.TargetGroupName
AutoRollbackConfiguration:
Enabled: true
Events:
- DEPLOYMENT_FAILURE
CodeDeployDGRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub ${Client}-${Env}-${ApplicationName}-code-deploy-role
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- codedeploy.amazonaws.com
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/AdministratorAccess'
Path: /
Tags:
- Key: env
Value: !Ref Env
CodeBuildRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub ${Client}-${Env}-${ApplicationName}-code-build-role
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- codebuild.amazonaws.com
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/AdministratorAccess'
Path: /
Tags:
- Key: env
Value: !Ref Env
CodeBuild:
Type: 'AWS::CodeBuild::Project'
Properties:
Name: !Sub ${Client}-${Env}-${ApplicationName}-code-build-project
Description: A description about my project
LogsConfig:
CloudWatchLogs:
Status: DISABLED
ServiceRole: !GetAtt
- CodeBuildRole
- Arn
Artifacts:
Type: CODEPIPELINE
Environment:
Type: LINUX_CONTAINER
ComputeType: BUILD_GENERAL1_SMALL
Image: 'aws/codebuild/amazonlinux2-x86_64-standard:3.0'
EnvironmentVariables:
- Name: ApplicationName
Type: PLAINTEXT
Value: !Ref ApplicationName
- Name: CS
Type: PLAINTEXT
Value: !Join
- ''
- - server=
- !GetAtt
- RDSInstance
- Endpoint.Address
- ;user id=
- !Ref DbUser
- ;password=
- !Ref DbPassword
- ;database=ChoixSejour
Source:
Type: CODEPIPELINE
Tags:
- Key: env
Value: !Ref Env
CodePipelineRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: !Sub ${Client}-${Env}-${ApplicationName}-code-pipeline-role
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- codepipeline.amazonaws.com
ManagedPolicyArns:
- 'arn:aws:iam::aws:policy/AdministratorAccess'
Path: /
Tags:
- Key: env
Value: !Ref Env
ArtifactBucket:
Type: 'AWS::S3::Bucket'
Properties:
BucketName: !Sub ${Client}-${Env}-${ApplicationName}-artifact-bucket
VersioningConfiguration:
Status: Enabled
Tags:
- Key: env
Value: !Ref Env
Secret:
Type: AWS::SecretsManager::Secret
Properties:
Description: 'Token for accessing github repo'
Name:
!Sub
- 'github_token_${client}_${environment}_${application_name}'
- { client: !Ref Client , environment: !Ref Env, application_name: !Ref ApplicationName }
SecretString:
!Sub
- '{"github_access_token_${client}_${environment}_${application_name}": "${token}"}'
- { client: !Ref Client, environment: !Ref Env, application_name: !Ref ApplicationName, token: !Ref Token }
Tags:
- Key: env
Value: !Ref Env
CodePipeline:
Type: 'AWS::CodePipeline::Pipeline'
DependsOn: Secret
Properties:
# Name: !Sub ${Client}-${Env}-${ApplicationName}-code-pipeline
ArtifactStore:
Location: !Ref ArtifactBucket
Type: S3
RoleArn: !GetAtt
- CodePipelineRole
- Arn
RestartExecutionOnUpdate: true
Stages:
- Actions:
- Name: SourceAction
ActionTypeId:
Category: Source
Owner: ThirdParty
Version: 1
Provider: GitHub
OutputArtifacts:
- Name: SourceArtifact
Configuration:
Owner: !Ref GithubUser
Repo: !Ref GitRepo
Branch: !Ref BranchRepo
OAuthToken:
!Sub
- '{{resolve:secretsmanager:github_token_${client}_${environment}_${application_name}:SecretString:github_access_token_${client}_${environment}_${application_name}}}'
# - '{{resolve:secretsmanager:github_token_test_choixsejour:SecretString:github_access_token_test_choixsejour}}'
- { client: !Ref Client, environment: !Ref Env, application_name: !Ref ApplicationName }
PollForSourceChanges: true
RunOrder: 1
Name: SOURCE
- Name: Build
Actions:
- Name: BuildAction
ActionTypeId:
Category: Build
Owner: AWS
Version: '1'
Provider: CodeBuild
InputArtifacts:
- Name: SourceArtifact
OutputArtifacts:
- Name: BuildArtifact
Configuration:
ProjectName: !Ref CodeBuild
RunOrder: 1
- Name: Deploy
Actions:
- Name: DeployAction
InputArtifacts:
- Name: BuildArtifact
ActionTypeId:
Category: Deploy
Owner: AWS
Version: '1'
Provider: CodeDeploy
Configuration:
ApplicationName: !Ref DeployApplication
DeploymentGroupName: !Ref DeploymentGroup
RunOrder: 1
Tags:
- Key: env
Value: !Ref Env
Outputs: {}