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

ALB Rule causes : Failed to describe rules: Parameter validation failed:\nInvalid type for parameter ListenerArn, value: None, type: <class 'NoneType'> #2400

Open
1 task done
aburgerhulft opened this issue Nov 26, 2024 · 1 comment
Labels
bug This issue/PR relates to a bug needs_info This issue requires further information. Please answer any outstanding questions

Comments

@aburgerhulft
Copy link

Summary

Can't add rules to ALB anymore.

Issue Type

Bug Report

Component Name

amazon.aws.elb_application_lb

Ansible Version

ansible [core 2.18.0]
  config file = None
  configured module search path = ['/Users/xxx/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /opt/homebrew/Cellar/ansible/11.0.0/libexec/lib/python3.13/site-packages/ansible
  ansible collection location = /Users/xxx/.ansible/collections:/usr/share/ansible/collections
  executable location = /opt/homebrew/bin/ansible
  python version = 3.13.0 (main, Oct  7 2024, 05:02:14) [Clang 15.0.0 (clang-1500.3.9.4)] (/opt/homebrew/Cellar/ansible/11.0.0/libexec/bin/python)
  jinja version = 3.1.4
  libyaml = True

Collection Versions

$ ansible-galaxy collection list

AWS SDK versions

Name: boto3
Version: 1.35.64
Summary: The AWS SDK for Python
Home-page: https://github.com/boto/boto3
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /opt/homebrew/Cellar/ansible/11.0.0/libexec/lib/python3.13/site-packages
Requires: botocore, jmespath, s3transfer
Required-by: 
---
Name: botocore
Version: 1.35.64
Summary: Low-level, data-driven core of boto 3.
Home-page: https://github.com/boto/botocore
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /opt/homebrew/Cellar/ansible/11.0.0/libexec/lib/python3.13/site-packages
Requires: jmespath, python-dateutil, urllib3
Required-by: boto3, s3transfer

Configuration

$ ansible-config dump --only-changed

OS / Environment

Mac OS

Steps to Reproduce

    amazon.aws.elb_application_lb:
        name: "{{ ansible_env.HULFTENV }}-main-{{ color }}"
        purge_listeners: true
        state: present
        subnets:
          - "{{ private_subnet_info1.subnets[0].subnet_id }}"
          - "{{ private_subnet_info2.subnets[0].subnet_id }}"
        security_groups:
          - "{{ lookup('amazon.aws.aws_secret', 'network/{{ansible_env.HULFTENV}}.VPCSecurityGroup', nested=true) }}"
        listeners:
          - Protocol: HTTP
            Port: 80
            DefaultActions:
              - Type: fixed-response
                FixedResponseConfig:
                  ContentType: "text/plain"
                  MessageBody: "This NOT the page you're looking for"
                  StatusCode: "503"
            Rules:
              - Conditions:
                  - Field: path-pattern
                    Values:
                      - '/web/*'
                Priority: '1'
                Actions:
                  - TargetGroupName: "ms-web-{{ color }}-tg"
                    Type: forward

Expected Results

Rules add to ALB

Actual Results

   "msg": "Failed to describe rules: Parameter validation failed:\nInvalid type for parameter ListenerArn, value: None, type: <class 'NoneType'>, valid types: <class 'str'>"
}

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@gravesm gravesm added bug This issue/PR relates to a bug needs_verified Some one might want to take a look at this and reproduce it to confirm and removed needs_triage labels Dec 3, 2024
@abikouo
Copy link
Contributor

abikouo commented Dec 13, 2024

@aburgerhulft The issue cannot be reproduced using the task you provided.
I tried using the following playbook

    - name: Create VPC
      amazon.aws.ec2_vpc_net:
        cidr_block: 10.1.0.0/16
        name: "{{ resource_prefix }}-vpc"
        tags: "{{ resource_tags }}"
      register: vpc_i

    - name: Attach internet gateway to VPC
      amazon.aws.ec2_vpc_igw:
        state: present
        vpc_id: "{{ vpc_i.vpc.id }}"

    - name: list availability zones
      amazon.aws.aws_az_info:
      register: zones

    - ansible.builtin.set_fact:
        zones_names: "{{ zones.availability_zones | map(attribute='zone_name') | list }}"

    - name: Create Subnet a
      amazon.aws.ec2_vpc_subnet:
        cidr: 10.1.23.0/24
        wait: true
        vpc_id: "{{ vpc_i.vpc.id }}"
        az: "{{ zones_names[0] }}"
      register: subnet_a

    - name: Create Subnet b
      amazon.aws.ec2_vpc_subnet:
        cidr: 10.1.24.0/24
        wait: true
        vpc_id: "{{ vpc_i.vpc.id }}"
        az: "{{ zones_names[1] }}"
      register: subnet_b

    - name: Create security group
      amazon.aws.ec2_security_group:
        name: "{{ resource_prefix  }}-sg"
        description: Security group for ICMP
        vpc_id: "{{ vpc_i.vpc.id }}"
        rules:
          - proto: icmp
            icmp_type: 3
            icmp_code: 1
            cidr_ip: 0.0.0.0/0
      register: security_group

    - name: Create a target group for testing
      community.aws.elb_target_group:
        name: "{{ resource_prefix }}-target"
        protocol: http
        port: 80
        vpc_id: "{{ vpc_i.vpc.id }}"
        state: present

    - name: Create ELB listeners
      amazon.aws.elb_application_lb:
        name: "{{ resource_prefix }}-listener"
        purge_listeners: true
        state: present
        subnets:
          - "{{ subnet_a.subnet.id }}"
          - "{{ subnet_b.subnet.id }}"
        security_groups:
          - "{{ security_group.group_id }}"
        listeners:
          - Protocol: HTTP
            Port: 80
            DefaultActions:
              - Type: fixed-response
                FixedResponseConfig:
                  ContentType: "text/plain"
                  MessageBody: "This is NOT the page you're looking for"
                  StatusCode: "503"
            Rules:
              - Conditions:
                  - Field: path-pattern
                    Values:
                      - '/web/*'
                Priority: '1'
                Actions:
                  - TargetGroupName: "{{ resource_prefix }}-target"
                    Type: forward

Could you please provide the full playbook and your collection version?

@abikouo abikouo added needs_info This issue requires further information. Please answer any outstanding questions and removed needs_verified Some one might want to take a look at this and reproduce it to confirm labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug needs_info This issue requires further information. Please answer any outstanding questions
Projects
None yet
Development

No branches or pull requests

3 participants