Skip to content

Molecule Destroy EC2 instances it did not create.  #38

Open
@jolillie

Description

@jolillie

Hello,

I have ran into a weird issue where when I run molecule create -s aws_ec2 I run into the following error:

FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: {{ item.image or platform_generated_image_id }}: {{ (ami_info.results[index].images | sort(attribute='creation_date', reverse=True))[0].image_id }}: 'dict object' has no attribute 'images'\n\nThe error appears to be in '/molecule/aws_ec2/create.yml': line 201, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Create ephemeral EC2 instance(s)\n      ^ here\n"
}

Then when I run molecule destroy -s aws_ec2 molecule ends up terminating an EC2 instance that it did not create.

I have been able to recreate this issue twice now. Let me know what logs or other information I can send to resolve this issue.

System Information:

ansible --version && molecule --version

 32527 1665089931.56849: starting run
ansible [core 2.13.4]
  config file = None
  configured module search path = ['/Users/Jon.Lillie/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/6.4.0/libexec/lib/python3.10/site-packages/ansible
  ansible collection location = /Users/Jon.Lillie/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible
  python version = 3.10.7 (main, Sep 15 2022, 01:51:29) [Clang 14.0.0 (clang-1400.0.29.102)]
  jinja version = 3.1.2
  libyaml = True

molecule 4.0.1 using python 3.10 
    ansible:2.13.4
    delegated:4.0.1 from molecule
    docker:2.0.0 from molecule_docker requiring collections: community.docker>=3.0.0-a2
    ec2:0.4 from molecule_ec2
    vagrant:1.0.0 from molecule_vagrant

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