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

ec2_instance fails when trying to run instance using a launch template without a defined default subnet #2321

Open
1 task done
abikouo opened this issue Oct 4, 2024 · 0 comments · May be fixed by #2323
Open
1 task done
Assignees

Comments

@abikouo
Copy link
Contributor

abikouo commented Oct 4, 2024

Summary

When trying to run instance using a launch template in an AWS environment where no default subnet is defined, the module fails with the following message

fatal: [localhost]: FAILED! => {"changed": false, "msg": "No default subnet could be found - you must include a VPC subnet ID (vpc_subnet_id parameter)."}

Issue Type

Bug Report

Component Name

ec2_instance

Ansible Version

$ ansible --version

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

$ pip show boto boto3 botocore

Configuration

$ ansible-config dump --only-changed

OS / Environment

No response

Steps to Reproduce

   - name: Create launch template
      community.aws.ec2_launch_template:
        template_name: "my-testing-template"
        instance_type: t2.micro
        image_id: "{{ vm_image_id }}"
        network_interfaces:
          - device_index: 0
            associate_public_ip_address: false
            delete_on_termination: true
            subnet_id: "{{ my_subnet_id }}"
            private_ip_address: "10.1.8.11"
      register: _create_template

    - name: Create EC2 instance using launch template
      amazon.aws.ec2_instance:
        state: present
        wait: true
        launch_template:
          name: "{{ _create_template.template.launch_template_id }}"

Expected Results

The module should succeed

Actual Results

fatal: [localhost]: FAILED! => {"changed": false, "msg": "No default subnet could be found - you must include a VPC subnet ID (vpc_subnet_id parameter)."}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@abikouo abikouo added WIP Work in progress and removed needs_triage labels Oct 4, 2024
@abikouo abikouo self-assigned this Oct 4, 2024
@abikouo abikouo linked a pull request Oct 4, 2024 that will close this issue
@abikouo abikouo added has_pr and removed WIP Work in progress labels Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants