Объект TargetGroup не поддерживает атрибут TargetGroupAttribute

Используя Troposphere и Python, я создал AWS NLB. Он отлично работает, я просто пытаюсь добавить к нему новое свойство. Я пытаюсь добавить свойство deregistration_delay.connection_termination.enabled. Но когда я пытаюсь обновить свою строфу, мне не нравится мой синтаксис.

Вот мой блок кода с атрибутом TargetGroupAttribute, который я пытаюсь добавить.

      my_target_group = t.add_resource(elb.TargetGroup(
    "MyTargetGroup",
    Name = 'MyTGName',
    Port = os.getenv('PORT'),
    Protocol = os.getenv('PROTOCOL'),
    VpcId = MyVPCid.id,
    HealthCheckIntervalSeconds = os.getenv('HEALTH_CHECK_INTERVAL_SECONDS'),
    HealthCheckPort = os.getenv('PORT'),
    HealthCheckProtocol = os.getenv('HEALTH_CHECK_PROTOCOL'),
    HealthyThresholdCount = os.getenv('HEALTHY_THRESHOLD_COUNT'),
    UnhealthyThresholdCount = os.getenv('UNHEALTHY_THRESHOLD_COUNT'),
    TargetGroupAttribute = [
        elb.TargetGroupAttribute(
            Key='deregistration_delay.connection_termination.enabled',
            Value='true'
        )
    ],
    Targets = build_tg_desc_lst(list_of_instances, os.getenv('PORT'))
))

Ему не нравится раздел «TargetGroupAttribute» в блоке кода, которым я поделился. Я получаю сообщение об ошибке «Объект TargetGroup не поддерживает атрибут TargetGroupAttribute».

Документация AWS является здесь , что я использовал , чтобы добавить свойство.

Мы будем очень благодарны за любой совет или помощь. Спасибо!

1 ответ

I was able to resolve the issue. I'm not sure why this was the case but I was able to successfully deploy the NLB with the Deregistration attribute enabled by the following.

Orginal Code

      TargetGroupAttribute = [
        elb.TargetGroupAttribute(
            Key='deregistration_delay.connection_termination.enabled',
            Value='true'
        )
    ]

New Code

      TargetGroupAttributes = [
        elb.TargetGroupAttribute(
            Key='deregistration_delay.connection_termination.enabled',
            Value='true'
        )
    ]

By adding an 's' at the end of the variable resolved the issue.

Другие вопросы по тегам