Skip to content

Unable to create ec2 instance with default create template with error The filter '<' is invalid #40

Open
@gionn

Description

Hello,

I tried to create a new scenario with molecule init scenario -d ec2, and then running molecule create:

PLAY [Create] **********************************************************************************************************

TASK [Validate platform configurations] ********************************************************************************
ok: [localhost] => (item=instance)

TASK [Write run config to file] ****************************************************************************************
ok: [localhost]

TASK [Generate local key pairs] ****************************************************************************************
ok: [localhost] => (item=instance)

TASK [Look up EC2 AMI(s) by owner and name (if image not set)] *********************************************************
skipping: [localhost] => (item=instance)

TASK [Look up subnets to determine VPCs (if needed)] *******************************************************************
ok: [localhost] => (item=instance)

TASK [Validate discovered information] *********************************************************************************
ok: [localhost] => (item=instance)

TASK [Create ephemeral EC2 keys (if needed)] ***************************************************************************
skipping: [localhost] => (item=instance)

TASK [Create ephemeral security groups (if needed)] ********************************************************************
ok: [localhost] => (item=instance)

TASK [Create ephemeral EC2 instance(s)] ********************************************************************************
changed: [localhost] => (item=instance)

TASK [Wait for instance creation to complete] **************************************************************************
FAILED - RETRYING: Wait for instance creation to complete (300 retries left).

I always get an AWS client exception (truncate output for readability):

return self._method(**current_kwargs)", "  File \"/Users/Giovanni.Toraldo/.pyenv/versions/3.9.0/lib/python3.9/site-packages/botocore/client.py\", line 391, in _api_call", "    return self._make_api_call(operation_name, kwargs)", "  File \"/Users/Giovanni.Toraldo/.pyenv/versions/3.9.0/lib/python3.9/site-packages/botocore/client.py\", line 719, in _make_api_call", "    raise error_class(parsed_response, operation_name)", "botocore.exceptions.ClientError: An error occurred (InvalidParameterValue) when calling the DescribeInstances operation: The filter '<' is invalid"]}

Relevant dependencies:

ansible==2.9.21
molecule==3.5.2
molecule-docker==1.1.0
molecule-ec2==0.4
boto3==1.20.46
botocore==1.23.46

Workaround is to remove the filters attribute in the ec2_instance resource in the Create ephemeral EC2 instance(s) step in create.yml:

    - name: Create ephemeral EC2 instance(s)
      ec2_instance:
        profile: "{{ item.aws_profile | default(omit) }}"
        region: "{{ item.region | default(omit) }}"
        #filters: "{{ platform_filters }}"
        instance_type: "{{ item.instance_type }}"
        image_id: "{{ platform_image_id }}"
        vpc_subnet_id: "{{ item.vpc_subnet_id }}"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ec2Amazon EC2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions