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

Fix to allow lambda runtime to be updated #56922

Open
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@chalupaa
Copy link
Contributor

commented May 24, 2019

SUMMARY

Fix allows lambda module to update the runtime. The module currently detects runtime changes and disallows them. However, the underlying boto api supports updating the runtime to any supported value. AWS is actively deprecating older runtme versions and this module is not supporting updates to supported versions.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lambda.py

ADDITIONAL INFORMATION

The boto3 call for lambda update_function_configuration allows you to specify any supported runtime. The module was detecting a runtime change and failing the task.

Before

$ ansible-playbook  lambda_function.yml

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

TASK [Gathering Facts] ************************************************************************************************************************************************************
ok: [localhost]

TASK [Deploy lambda functions] ****************************************************************************************************************************************************
failed: [localhost] (item={u'name': u'test', u'tags': {u'Env': u'test'}, u'zip_file': u'lambda.zip', u'handler': u'lambda_function.lambda_handler', u'role': u'arn:aws:iam::XXXXXXXXXX:role/lambda', u'timeout': u'10', u'environment_variables': {}, u'memory_size': u'128', u'runtime': u'python3.7'}) => {
    "changed": false,
    "item": {
        "environment_variables": {},
        "handler": "lambda_function.lambda_handler",
        "memory_size": "128",
        "name": "test",
        "role": "arn:aws:iam::XXXXXXXXXX:role/lambda",
        "runtime": "python3.7",
        "tags": {
            "Env": "test"
        },
        "timeout": "10",
        "zip_file": "lambda.zip"
    }
}

MSG:

Cannot change runtime. Please recreate the function


PLAY RECAP ************************************************************************************************************************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=1

After

$ ansible-playbook lambda_function.yml


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

TASK [Gathering Facts] ************************************************************************************************************************************************************
ok: [localhost]

TASK [Deploy lambda functions] ****************************************************************************************************************************************************
changed: [localhost] => (item={u'name': u'test', u'tags': {u'Env': u'test'}, u'zip_file': u'lambda.zip', u'handler': u'lambda_function.lambda_handler', u'role': u'arn:aws:iam::XXXXXXXXXX:role/lambda', u'timeout': u'10', u'environment_variables': {}, u'memory_size': u'128', u'runtime': u'python3.7'})

PLAY RECAP ************************************************************************************************************************************************************************
localhost                  : ok=2    changed=1    unreachable=0    failed=0
@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 24, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented May 24, 2019

@chalupaa, 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

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.