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

elb_application_lb_info - Add parameters to skip fetching some data #1778

Merged

Conversation

cosandr
Copy link
Contributor

@cosandr cosandr commented Sep 28, 2023

Add include_attributes, include_listeners and include_listener_rules.

SUMMARY

Related to #1767.

This PR adds parameters to the module which disable fetching certain data.
They all default to true for backwards compatibility. In my tests disabling all 3 speeds it up by around 10x when fetching a lot (100+) ALBs.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

elb_application_lb_info

ADDITIONAL INFORMATION

Please let me know if the coupling of include_listeners and include_listener_rules isn't desired. I can add checks to require include_listeners be true if include_listener_rules as an alternative (or something else?).

Add include_attributes, include_listeners and include_listener_rules.
@github-actions
Copy link

github-actions bot commented Sep 28, 2023

Docs Build 📝

Thank you for contribution!✨

The docsite for this PR is available for download as an artifact from this run:
https://github.com/ansible-collections/amazon.aws/actions/runs/6349869793

You can compare to the docs for the main branch here:
https://ansible-collections.github.io/amazon.aws/branch/main

File changes:

  • M collections/amazon/aws/elb_application_lb_info_module.html
Click to see the diff comparison.

NOTE: only file modifications are shown here. New and deleted files are excluded.
See the file list and check the published docs to see those files.

diff --git a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/elb_application_lb_info_module.html b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/elb_application_lb_info_module.html
index 1e37183..bfbfd72 100644
--- a/home/runner/work/amazon.aws/amazon.aws/docsbuild/base/collections/amazon/aws/elb_application_lb_info_module.html
+++ b/home/runner/work/amazon.aws/amazon.aws/docsbuild/head/collections/amazon/aws/elb_application_lb_info_module.html
@@ -246,20 +246,60 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 </div></td>
 </tr>
 <tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-include_attributes"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-include-attributes"><strong>include_attributes</strong></p>
+<a class="ansibleOptionLink" href="#parameter-include_attributes" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 7.0.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Whether or not to include load balancer attributes in the response.</p>
+<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
+<ul class="simple">
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">true</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-include_listener_rules"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-include-listener-rules"><strong>include_listener_rules</strong></p>
+<a class="ansibleOptionLink" href="#parameter-include_listener_rules" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 7.0.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Whether or not to include load balancer listener rules in the response.</p>
+<p>Implies <em>include_listeners=true</em></p>
+<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
+<ul class="simple">
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">true</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-odd"><td><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="parameter-include_listeners"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-include-listeners"><strong>include_listeners</strong></p>
+<a class="ansibleOptionLink" href="#parameter-include_listeners" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+<p><em class="ansible-option-versionadded">added in amazon.aws 7.0.0</em></p>
+</div></td>
+<td><div class="ansible-option-cell"><p>Whether or not to include load balancer listeners in the response.</p>
+<p class="ansible-option-line"><strong class="ansible-option-choices">Choices:</strong></p>
+<ul class="simple">
+<li><p><code class="ansible-option-choices-entry docutils literal notranslate"><span class="pre">false</span></code></p></li>
+<li><p><code class="ansible-option-default-bold docutils literal notranslate"><strong><span class="pre">true</span></strong></code> <span class="ansible-option-choices-default-mark">← (default)</span></p></li>
+</ul>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-load_balancer_arns"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-load-balancer-arns"><strong>load_balancer_arns</strong></p>
 <a class="ansibleOptionLink" href="#parameter-load_balancer_arns" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=string</span></p>
 </div></td>
 <td><div class="ansible-option-cell"><p>The Amazon Resource Names (ARN) of the load balancers. You can specify up to 20 load balancers in a single call.</p>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-names"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-names"><strong>names</strong></p>
 <a class="ansibleOptionLink" href="#parameter-names" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=string</span></p>
 </div></td>
 <td><div class="ansible-option-cell"><p>The names of the load balancers.</p>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-profile"></div>
 <div class="ansibleOptionAnchor" id="parameter-aws_profile"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-profile"><span id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-aws-profile"></span><strong>profile</strong></p>
 <a class="ansibleOptionLink" href="#parameter-profile" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-aliases">aliases: aws_profile</span></p>
@@ -271,7 +311,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p>The <em>profile</em> option is mutually exclusive with the <em>aws_access_key</em>, <em>aws_secret_key</em> and <em>security_token</em> options.</p>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-region"></div>
 <div class="ansibleOptionAnchor" id="parameter-aws_region"></div>
 <div class="ansibleOptionAnchor" id="parameter-ec2_region"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-region"><span id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-ec2-region"></span><span id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-aws-region"></span><strong>region</strong></p>
@@ -286,7 +326,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_REGION</span></code> environment variable has been deprecated and will be removed in a release after 2024-12-01.</p>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-secret_key"></div>
 <div class="ansibleOptionAnchor" id="parameter-aws_secret_access_key"></div>
 <div class="ansibleOptionAnchor" id="parameter-aws_secret_key"></div>
@@ -303,7 +343,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_SECRET_KEY</span></code> environment variable has been deprecated and will be removed in a release after 2024-12-01.</p>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-session_token"></div>
 <div class="ansibleOptionAnchor" id="parameter-aws_session_token"></div>
 <div class="ansibleOptionAnchor" id="parameter-security_token"></div>
@@ -321,7 +361,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p>Support for the <code class="docutils literal notranslate"><span class="pre">EC2_SECRET_KEY</span></code> and <code class="docutils literal notranslate"><span class="pre">AWS_SECURITY_TOKEN</span></code> environment variables has been deprecated and will be removed in a release after 2024-12-01.</p>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="parameter-validate_certs"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-parameter-validate-certs"><strong>validate_certs</strong></p>
 <a class="ansibleOptionLink" href="#parameter-validate_certs" title="Permalink to this option"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
@@ -354,6 +394,13 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Gather information about all ALBs</span>
 <span class="w">  </span><span class="nt">amazon.aws.elb_application_lb_info</span><span class="p">:</span>
 
+<span class="c1"># Equivalent to aws elbv2 describe-load-balancers</span>
+<span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Gather minimal information about all ALBs</span>
+<span class="w">  </span><span class="nt">amazon.aws.elb_application_lb_info</span><span class="p">:</span>
+<span class="w">    </span><span class="nt">include_attributes</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
+<span class="w">    </span><span class="nt">include_listeners</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
+<span class="w">    </span><span class="nt">include_listener_rules</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">false</span>
+
 <span class="p p-Indicator">-</span><span class="w"> </span><span class="nt">name</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">Gather information about a particular ALB given its ARN</span>
 <span class="w">  </span><span class="nt">amazon.aws.elb_application_lb_info</span><span class="p">:</span>
 <span class="w">    </span><span class="nt">load_balancer_arns</span><span class="p">:</span>
@@ -398,7 +445,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/access_logs_s3_bucket" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The name of the S3 bucket for the access logs.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;mys3bucket&quot;</span></code></p>
 </div></td>
 </tr>
@@ -407,7 +454,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/access_logs_s3_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether access logs stored in Amazon S3 are enabled.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">true</span></code></p>
 </div></td>
 </tr>
@@ -416,7 +463,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/access_logs_s3_prefix" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The prefix for the location in the S3 bucket.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;my/logs&quot;</span></code></p>
 </div></td>
 </tr>
@@ -452,7 +499,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/deletion_protection_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether deletion protection is enabled.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">true</span></code></p>
 </div></td>
 </tr>
@@ -470,7 +517,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/idle_timeout_timeout_seconds" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">integer</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>The idle timeout value, in seconds.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">60</span></code></p>
 </div></td>
 </tr>
@@ -488,7 +535,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/listeners" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">complex</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Information about the listeners.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_listeners or include_listener_rules is true</p>
 </div></td>
 </tr>
 <tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-indent"></div><div class="ansible-option-cell">
@@ -571,6 +618,15 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 </div></td>
 </tr>
 <tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-load_balancers/listeners/rules"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-listeners-rules"><strong>rules</strong></p>
+<a class="ansibleOptionLink" href="#return-load_balancers/listeners/rules" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">list</span> / <span class="ansible-option-elements">elements=string</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>List of listener rules.</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_listener_rules is true</p>
+<p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">[&quot;&quot;]</span></code></p>
+</div></td>
+</tr>
+<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-indent"></div><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="return-load_balancers/listeners/ssl_policy"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-listeners-ssl-policy"><strong>ssl_policy</strong></p>
 <a class="ansibleOptionLink" href="#return-load_balancers/listeners/ssl_policy" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -579,7 +635,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;&quot;</span></code></p>
 </div></td>
 </tr>
-<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="return-load_balancers/load_balancer_arn"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-load-balancer-arn"><strong>load_balancer_arn</strong></p>
 <a class="ansibleOptionLink" href="#return-load_balancers/load_balancer_arn" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -588,7 +644,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;arn:aws:elasticloadbalancing:ap-southeast-2:123456789012:loadbalancer/app/my-alb/001122334455&quot;</span></code></p>
 </div></td>
 </tr>
-<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="return-load_balancers/load_balancer_name"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-load-balancer-name"><strong>load_balancer_name</strong></p>
 <a class="ansibleOptionLink" href="#return-load_balancers/load_balancer_name" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
@@ -597,12 +653,21 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;my-alb&quot;</span></code></p>
 </div></td>
 </tr>
+<tr class="row-odd"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
+<div class="ansibleOptionAnchor" id="return-load_balancers/load_balancing_cross_zone_enabled"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-load-balancing-cross-zone-enabled"><strong>load_balancing_cross_zone_enabled</strong></p>
+<a class="ansibleOptionLink" href="#return-load_balancers/load_balancing_cross_zone_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
+</div></td>
+<td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether or not cross-zone load balancing is enabled.</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
+<p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">true</span></code></p>
+</div></td>
+</tr>
 <tr class="row-even"><td><div class="ansible-option-indent"></div><div class="ansible-option-cell">
 <div class="ansibleOptionAnchor" id="return-load_balancers/routing_http2_enabled"></div><p class="ansible-option-title" id="ansible-collections-amazon-aws-elb-application-lb-info-module-return-load-balancers-routing-http2-enabled"><strong>routing_http2_enabled</strong></p>
 <a class="ansibleOptionLink" href="#return-load_balancers/routing_http2_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether HTTP/2 is enabled.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">true</span></code></p>
 </div></td>
 </tr>
@@ -611,7 +676,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/routing_http_desync_mitigation_mode" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">string</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Determines how the load balancer handles requests that might pose a security risk to an application.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">&quot;defensive&quot;</span></code></p>
 </div></td>
 </tr>
@@ -620,7 +685,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/routing_http_drop_invalid_header_fields_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether HTTP headers with invalid header fields are removed by the load balancer (true) or routed to targets (false).</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">false</span></code></p>
 </div></td>
 </tr>
@@ -629,7 +694,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/routing_http_x_amzn_tls_version_and_cipher_suite_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether the two headers are added to the client request before sending it to the target.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">false</span></code></p>
 </div></td>
 </tr>
@@ -638,7 +703,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/routing_http_xff_client_port_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether the X-Forwarded-For header should preserve the source port that the client used to connect to the load balancer.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">false</span></code></p>
 </div></td>
 </tr>
@@ -701,7 +766,7 @@ see <a class="reference internal" href="#ansible-collections-amazon-aws-elb-appl
 <a class="ansibleOptionLink" href="#return-load_balancers/waf_fail_open_enabled" title="Permalink to this return value"></a><p class="ansible-option-type-line"><span class="ansible-option-type">boolean</span></p>
 </div></td>
 <td><div class="ansible-option-indent-desc"></div><div class="ansible-option-cell"><p>Indicates whether to allow a AWS WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF.</p>
-<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> success</p>
+<p class="ansible-option-line"><strong class="ansible-option-returned-bold">Returned:</strong> when include_attributes is true</p>
 <p class="ansible-option-line ansible-option-sample"><strong class="ansible-option-sample-bold">Sample:</strong> <code class="ansible-option-sample docutils literal notranslate"><span class="pre">false</span></code></p>
 </div></td>
 </tr>

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/5dca5560e4b74663924213df77d3ad08

✔️ ansible-galaxy-importer SUCCESS in 8m 45s
✔️ build-ansible-collection SUCCESS in 12m 33s
✔️ ansible-test-splitter SUCCESS in 4m 38s
✔️ integration-amazon.aws-1 SUCCESS in 10m 45s
Skipped 43 jobs

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking the time to submit this PR. The next planned 6.x release is Tuesday, so we probably won't get this merged, reviewed and backported in time. After that we plan to release 7.0.0 in the first few days of November and 6.x will become bugfixes only. As such I've suggested a version_added of 7.0.0

It would be good if you could also add some basic tests to tests/integration/targets/elb_application_lb/tasks/main.yml

There seem to be some half written tests around line 1360, usually we'd test that alb_info.load_balancers[0] contains (and in this case also does NOT contain) the keys we'd expect, testing values where they can be easily predicted. If you don't have time I might be able to get some written next week.

plugins/modules/elb_application_lb_info.py Show resolved Hide resolved
plugins/modules/elb_application_lb_info.py Show resolved Hide resolved
plugins/modules/elb_application_lb_info.py Show resolved Hide resolved
Co-authored-by: Mark Chappell <mchappel@redhat.com>
@cosandr
Copy link
Contributor Author

cosandr commented Sep 29, 2023

Sounds good. As for tests I can have a look but I'm not sure if I'll get to actually running them.

@tremble
Copy link
Contributor

tremble commented Sep 29, 2023

Sounds good. As for tests I can have a look but I'm not sure if I'll get to actually running them.

They'll be run automatically: there's a check called ansible/check (ignore ansible/gate that's a final double/check before automated merging) they're a little tedious to write, but they really help catch bugs and regressions.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/302285290c57435d9760ed2161dfb47b

✔️ ansible-galaxy-importer SUCCESS in 4m 12s
✔️ build-ansible-collection SUCCESS in 13m 18s
✔️ ansible-test-splitter SUCCESS in 5m 12s
✔️ integration-amazon.aws-1 SUCCESS in 9m 28s
Skipped 43 jobs

@cosandr
Copy link
Contributor Author

cosandr commented Sep 29, 2023

I've added some tests, I didn't manage to run ansible-test locally (in docker at least), it complains about couldn't resolve module/action 'elb_target_group' which is from community.aws, not sure what's going on there. I've tried most of these individually however.

I'm also not sure if we should be checking all the attributes returned when include_attributes is true. They aren't declared in the module so the tests could break due to an AWS change, although removing all but 1/2 just reduces the chances of that happening I suppose.

@tremble
Copy link
Contributor

tremble commented Sep 29, 2023

I'm also not sure if we should be checking all the attributes returned when include_attributes is true. They aren't declared in the module so the tests could break due to an AWS change, although removing all but 1/2 just reduces the chances of that happening I suppose.

I don't recall AWS removing info from APIs, they usually catch us out by adding new info (if we're not careful with how we perform "changed" comparisons)

I'm good with this PR just testing the features it's explicitly enabling/disabled.

@softwarefactory-project-zuul
Copy link
Contributor

Build failed.
https://ansible.softwarefactory-project.io/zuul/buildset/182b6ea0e59e492c86a3a63251f2c61d

✔️ ansible-galaxy-importer SUCCESS in 4m 36s
✔️ build-ansible-collection SUCCESS in 13m 17s
✔️ ansible-test-splitter SUCCESS in 4m 44s
integration-amazon.aws-1 FAILURE in 13m 18s
✔️ integration-amazon.aws-2 SUCCESS in 6m 23s
Skipped 42 jobs

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/7acb639f59154ab2bdddf36aa30b8684

✔️ ansible-galaxy-importer SUCCESS in 5m 10s
✔️ build-ansible-collection SUCCESS in 12m 52s
✔️ ansible-test-splitter SUCCESS in 4m 50s
✔️ integration-amazon.aws-1 SUCCESS in 13m 51s
✔️ integration-amazon.aws-2 SUCCESS in 6m 26s
Skipped 42 jobs

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Sep 29, 2023
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/9f17d4ac03ec496ca84473f3e7972821

✔️ ansible-galaxy-importer SUCCESS in 3m 41s
✔️ build-ansible-collection SUCCESS in 13m 19s
✔️ ansible-test-splitter SUCCESS in 5m 21s
✔️ integration-amazon.aws-1 SUCCESS in 10m 04s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit a48f4c2 into ansible-collections:main Sep 29, 2023
7 checks passed
alinabuzachis pushed a commit to alinabuzachis/amazon.aws that referenced this pull request Oct 2, 2023
…nsible-collections#1778)

elb_application_lb_info - Add parameters to skip fetching some data

Add include_attributes, include_listeners and include_listener_rules.
SUMMARY
Related to ansible-collections#1767.
This PR adds parameters to the module which disable fetching certain data.
They all default to true for backwards compatibility. In my tests disabling all 3 speeds it up by around 10x when fetching a lot (100+) ALBs.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
elb_application_lb_info
ADDITIONAL INFORMATION
Please let me know if the coupling of include_listeners and include_listener_rules isn't desired. I can add checks to require include_listeners be true if include_listener_rules as an alternative (or something else?).

Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants