Skip to content
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

ability to use lambda target in elb_target_group #57394

Open
wants to merge 6 commits into
base: devel
from

Conversation

Projects
None yet
3 participants
@markuman
Copy link

commented Jun 5, 2019

SUMMARY

Since late 2018 it is possible to use a lambda function as a target in a target group.
This pull request add the ability to use a lambda function as a target.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

elb_target_group

ADDITIONAL INFORMATION

This pull request fixes #52253

---
- hosts: localhost
  gather_facts: False


  tasks:

    - name: first, create empty target group
      elb_target_group:
        name: my-lambda-targetgroup
        target_type: lambda
        state: present
        modify_targets: False
      register: out

    - name: second, allow invoke of the lambda
      lambda_policy:
        state: present
        function_name: mb_dev3
        statement_id: someID
        action: lambda:InvokeFunction
        principal: elasticloadbalancing.amazonaws.com
        source_arn: "{{ out.target_group_arn }}"

    - name: third, add target
      elb_target_group:
        name: my-lambda-targetgroup
        target_type: lambda
        state: present
        targets:
          - Id: arn:aws:lambda:eu-central-1:507463463146:function:mb_dev3
ansible-playbook test.yml 

PLAY [localhost] *******************************************************************************************************************************************************************************************************************

TASK [first, create empty target group] ********************************************************************************************************************************************************************************************
changed: [localhost]

TASK [second, allow invoke of the lambda] ******************************************************************************************************************************************************************************************
changed: [localhost]

TASK [third, add target] ***********************************************************************************************************************************************************************************************************
changed: [localhost]

PLAY RECAP *************************************************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0   
@anryko

This comment has been minimized.

if current_targets["TargetHealthDescriptions"]:
    changed = True
    # only one target is possible with lambda
    target_to_remove = current_targets["TargetHealthDescriptions"][0]["Target"]["Id"] 

This comment has been minimized.

Copy link
Owner

replied Jun 5, 2019

done

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 5, 2019

@markuman, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

@ansibot ansibot added the stale_ci label Jun 13, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.