File tree Expand file tree Collapse file tree 4 files changed +68
-7
lines changed
Expand file tree Collapse file tree 4 files changed +68
-7
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,18 @@ class SyncComputeCommand extends Command
1515 protected array $ steps = [
1616 Steps \Compute \SyncLaunchTemplateStep::class,
1717 Steps \Compute \SyncApplicationLoadBalancerStep::class,
18- Steps \Compute \AttachSslCertificateToLoadBalancerListenerStep::class,
19- Steps \Compute \AttachMultitenancySslCertificateToLoadBalancerListenerStep::class,
2018 Steps \Compute \SyncTargetGroupStep::class,
2119 Steps \Compute \SyncListenerOnPort80Step::class,
20+
21+ // domain
2222 Steps \Compute \SyncListenerOnPort443Step::class,
23+ Steps \Compute \AttachSslCertificateToLoadBalancerListenerStep::class,
24+
25+ // multitenancy
26+ Steps \Compute \SyncMultitenancyListenerOnPort443Step::class,
27+ Steps \Compute \AttachMultitenancySslCertificateToLoadBalancerListenerStep::class,
28+
29+ // transcoder
2330 Steps \Compute \SyncElasticTranscoderPipelineStep::class,
2431 Steps \Compute \SyncElasticTranscoderPresetStep::class,
2532 ];
Original file line number Diff line number Diff line change 55use Codinglabs \Yolo \Aws ;
66use Illuminate \Support \Arr ;
77use Codinglabs \Yolo \Helpers ;
8+ use Codinglabs \Yolo \Manifest ;
89use Codinglabs \Yolo \AwsResources ;
9- use Codinglabs \Yolo \Contracts \Step ;
1010use Codinglabs \Yolo \Enums \StepResult ;
11+ use Codinglabs \Yolo \Contracts \ExecutesDomainStep ;
1112use Codinglabs \Yolo \Exceptions \ResourceDoesNotExistException ;
1213
13- class SyncListenerOnPort443Step implements Step
14+ class SyncListenerOnPort443Step implements ExecutesDomainStep
1415{
1516 public function __invoke (array $ options ): StepResult
1617 {
@@ -23,15 +24,19 @@ public function __invoke(array $options): StepResult
2324 'LoadBalancerArn ' => AwsResources::loadBalancer ()['LoadBalancerArn ' ],
2425 'Protocol ' => 'HTTPS ' ,
2526 'Port ' => 443 ,
26- 'Certificates ' => [], // todo: cannot create this without any certificates
27+ 'Certificates ' => [
28+ [
29+ 'CertificateArn ' => AwsResources::certificate (Manifest::apex ())['CertificateArn ' ],
30+ ],
31+ ],
2732 'DefaultActions ' => [
2833 [
2934 'Type ' => 'forward ' ,
3035 'TargetGroupArn ' => AwsResources::targetGroup ()['TargetGroupArn ' ],
3136 ],
3237 ],
3338 ...Aws::tags ([
34- 'Name ' => Helpers::keyedResourceName (exclusive: false )
39+ 'Name ' => Helpers::keyedResourceName (' https ' , exclusive: false )
3540 ]),
3641 ]);
3742
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ public function __invoke(array $options): StepResult
3030 ],
3131 ],
3232 ...Aws::tags ([
33- 'Name ' => Helpers::keyedResourceName (exclusive: false )
33+ 'Name ' => Helpers::keyedResourceName (' http ' , exclusive: false )
3434 ]),
3535 ]);
3636
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Codinglabs \Yolo \Steps \Compute ;
4+
5+ use Codinglabs \Yolo \Aws ;
6+ use Illuminate \Support \Arr ;
7+ use Codinglabs \Yolo \Helpers ;
8+ use Codinglabs \Yolo \Manifest ;
9+ use Codinglabs \Yolo \AwsResources ;
10+ use Codinglabs \Yolo \Enums \StepResult ;
11+ use Codinglabs \Yolo \Contracts \ExecutesMultitenancyStep ;
12+ use Codinglabs \Yolo \Exceptions \ResourceDoesNotExistException ;
13+
14+ class SyncMultitenancyListenerOnPort443Step implements ExecutesMultitenancyStep
15+ {
16+ public function __invoke (array $ options ): StepResult
17+ {
18+ try {
19+ AwsResources::loadBalancerListenerOnPort (443 );
20+ return StepResult::SYNCED ;
21+ } catch (ResourceDoesNotExistException ) {
22+ if (! Arr::get ($ options , 'dry-run ' )) {
23+ Aws::elasticLoadBalancingV2 ()->createListener ([
24+ 'LoadBalancerArn ' => AwsResources::loadBalancer ()['LoadBalancerArn ' ],
25+ 'Protocol ' => 'HTTPS ' ,
26+ 'Port ' => 443 ,
27+ 'Certificates ' => [
28+ [
29+ 'CertificateArn ' => AwsResources::certificate (Manifest::tenants ()[0 ]['apex ' ])['CertificateArn ' ],
30+ ],
31+ ],
32+ 'DefaultActions ' => [
33+ [
34+ 'Type ' => 'forward ' ,
35+ 'TargetGroupArn ' => AwsResources::targetGroup ()['TargetGroupArn ' ],
36+ ],
37+ ],
38+ ...Aws::tags ([
39+ 'Name ' => Helpers::keyedResourceName (exclusive: false )
40+ ]),
41+ ]);
42+
43+ return StepResult::CREATED ;
44+ }
45+
46+ return StepResult::WOULD_CREATE ;
47+ }
48+ }
49+ }
You can’t perform that action at this time.
0 commit comments