Skip to content

Commit

Permalink
Remove static TargetName
Browse files Browse the repository at this point in the history
  • Loading branch information
muratugureminoglu committed May 10, 2024
1 parent 77c2959 commit 489df0a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aws-custom-cluster/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Resources:
ALBTargetGroupLambda:
Type: 'AWS::ElasticLoadBalancingV2::TargetGroup'
Properties:
Name: ALBTargetGroupLambda
# Name: ALBTargetGroupLambda
TargetType: lambda
Targets:
- Id: !GetAtt LambdaFunctionTrigger.Arn
Expand Down Expand Up @@ -819,6 +819,7 @@ Resources:
def lambda_handler(event, context):
listener_arn = os.environ['LISTENER_ARN']
origin_asg = os.environ['ORIGIN_ASG']
target_group_arn = os.environ['TARGETGROUP_ARN']
autoscaling_client = boto3.client('autoscaling')
elb_client = boto3.client('elbv2')
asg_names = autoscaling_client.describe_auto_scaling_groups()
Expand All @@ -832,9 +833,6 @@ Resources:
)
target_group_name = elb_client.describe_target_groups(Names=['ALBTargetGroupLambda'])
target_group_arn= target_group_name['TargetGroups'][0]['TargetGroupArn']
create_rule = elb_client.create_rule(
Actions=[
{
Expand Down Expand Up @@ -868,6 +866,7 @@ Resources:
Variables:
ORIGIN_ASG: !Sub "${AWS::StackName}-OriginGroup"
LISTENER_ARN: !Ref ALBListener443
TARGETGROUP_ARN: !Ref ALBTargetGroupLambda
LambdaGetApiKey:
Type: AWS::Lambda::Function
DependsOn: ApiGatewayApiKey
Expand Down

0 comments on commit 489df0a

Please sign in to comment.