diff --git a/changelogs/fragments/1365-elb_network_lb-ip_address_type.yml b/changelogs/fragments/1365-elb_network_lb-ip_address_type.yml new file mode 100644 index 00000000000..e80244cbcb0 --- /dev/null +++ b/changelogs/fragments/1365-elb_network_lb-ip_address_type.yml @@ -0,0 +1,2 @@ +bugfixes: +- elb_network_lb - fixes bug where ``ip_address_type`` in return value was not updated (https://github.com/ansible-collections/community.aws/pull/1365). diff --git a/plugins/modules/elb_network_lb.py b/plugins/modules/elb_network_lb.py index 00b8f466f8a..e82fe7ed79d 100644 --- a/plugins/modules/elb_network_lb.py +++ b/plugins/modules/elb_network_lb.py @@ -183,138 +183,144 @@ ''' RETURN = r''' -availability_zones: - description: The Availability Zones for the load balancer. +load_balancer: + description: A representation of the Network Load Balancer returned: when state is present - type: list - sample: "[{'subnet_id': 'subnet-aabbccddff', 'zone_name': 'ap-southeast-2a', 'load_balancer_addresses': []}]" -canonical_hosted_zone_id: - description: The ID of the Amazon Route 53 hosted zone associated with the load balancer. - returned: when state is present - type: str - sample: ABCDEF12345678 -created_time: - description: The date and time the load balancer was created. - returned: when state is present - type: str - sample: "2015-02-12T02:14:02+00:00" -deletion_protection_enabled: - description: Indicates whether deletion protection is enabled. - returned: when state is present - type: str - sample: true -dns_name: - description: The public DNS name of the load balancer. - returned: when state is present - type: str - sample: internal-my-elb-123456789.ap-southeast-2.elb.amazonaws.com -idle_timeout_timeout_seconds: - description: The idle timeout value, in seconds. - returned: when state is present - type: str - sample: 60 -ip_address_type: - description: The type of IP addresses used by the subnets for the load balancer. - returned: when state is present - type: str - sample: ipv4 -listeners: - description: Information about the listeners. - returned: when state is present - type: complex + type: dict + version_added: 5.0.0 contains: - listener_arn: - description: The Amazon Resource Name (ARN) of the listener. + availability_zones: + description: The Availability Zones for the load balancer. + returned: when state is present + type: list + sample: "[{'subnet_id': 'subnet-aabbccddff', 'zone_name': 'ap-southeast-2a', 'load_balancer_addresses': []}]" + canonical_hosted_zone_id: + description: The ID of the Amazon Route 53 hosted zone associated with the load balancer. returned: when state is present type: str - sample: "" - load_balancer_arn: - description: The Amazon Resource Name (ARN) of the load balancer. + sample: ABCDEF12345678 + created_time: + description: The date and time the load balancer was created. returned: when state is present type: str - sample: "" - port: - description: The port on which the load balancer is listening. + sample: "2015-02-12T02:14:02+00:00" + deletion_protection_enabled: + description: Indicates whether deletion protection is enabled. returned: when state is present - type: int - sample: 80 - protocol: - description: The protocol for connections from clients to the load balancer. + type: str + sample: true + dns_name: + description: The public DNS name of the load balancer. returned: when state is present type: str - sample: HTTPS - certificates: - description: The SSL server certificate. + sample: internal-my-elb-123456789.ap-southeast-2.elb.amazonaws.com + idle_timeout_timeout_seconds: + description: The idle timeout value, in seconds. + returned: when state is present + type: str + sample: 60 + ip_address_type: + description: The type of IP addresses used by the subnets for the load balancer. + returned: when state is present + type: str + sample: ipv4 + listeners: + description: Information about the listeners. returned: when state is present type: complex contains: - certificate_arn: - description: The Amazon Resource Name (ARN) of the certificate. + listener_arn: + description: The Amazon Resource Name (ARN) of the listener. returned: when state is present type: str sample: "" - ssl_policy: - description: The security policy that defines which ciphers and protocols are supported. - returned: when state is present - type: str - sample: "" - default_actions: - description: The default actions for the listener. - returned: when state is present - type: str - contains: - type: - description: The type of action. + load_balancer_arn: + description: The Amazon Resource Name (ARN) of the load balancer. returned: when state is present type: str sample: "" - target_group_arn: - description: The Amazon Resource Name (ARN) of the target group. + port: + description: The port on which the load balancer is listening. + returned: when state is present + type: int + sample: 80 + protocol: + description: The protocol for connections from clients to the load balancer. + returned: when state is present + type: str + sample: HTTPS + certificates: + description: The SSL server certificate. + returned: when state is present + type: complex + contains: + certificate_arn: + description: The Amazon Resource Name (ARN) of the certificate. + returned: when state is present + type: str + sample: "" + ssl_policy: + description: The security policy that defines which ciphers and protocols are supported. returned: when state is present type: str sample: "" -load_balancer_arn: - description: The Amazon Resource Name (ARN) of the load balancer. - returned: when state is present - type: str - sample: arn:aws:elasticloadbalancing:ap-southeast-2:0123456789:loadbalancer/app/my-elb/001122334455 -load_balancer_name: - description: The name of the load balancer. - returned: when state is present - type: str - sample: my-elb -load_balancing_cross_zone_enabled: - description: Indicates whether cross-zone load balancing is enabled. - returned: when state is present - type: str - sample: true -scheme: - description: Internet-facing or internal load balancer. - returned: when state is present - type: str - sample: internal -state: - description: The state of the load balancer. - returned: when state is present - type: dict - sample: "{'code': 'active'}" -tags: - description: The tags attached to the load balancer. - returned: when state is present - type: dict - sample: "{ - 'Tag': 'Example' - }" -type: - description: The type of load balancer. - returned: when state is present - type: str - sample: network -vpc_id: - description: The ID of the VPC for the load balancer. - returned: when state is present - type: str - sample: vpc-0011223344 + default_actions: + description: The default actions for the listener. + returned: when state is present + type: str + contains: + type: + description: The type of action. + returned: when state is present + type: str + sample: "" + target_group_arn: + description: The Amazon Resource Name (ARN) of the target group. + returned: when state is present + type: str + sample: "" + load_balancer_arn: + description: The Amazon Resource Name (ARN) of the load balancer. + returned: when state is present + type: str + sample: arn:aws:elasticloadbalancing:ap-southeast-2:0123456789:loadbalancer/app/my-elb/001122334455 + load_balancer_name: + description: The name of the load balancer. + returned: when state is present + type: str + sample: my-elb + load_balancing_cross_zone_enabled: + description: Indicates whether cross-zone load balancing is enabled. + returned: when state is present + type: str + sample: true + scheme: + description: Internet-facing or internal load balancer. + returned: when state is present + type: str + sample: internal + state: + description: The state of the load balancer. + returned: when state is present + type: dict + sample: "{'code': 'active'}" + tags: + description: The tags attached to the load balancer. + returned: when state is present + type: dict + sample: "{ + 'Tag': 'Example' + }" + type: + description: The type of load balancer. + returned: when state is present + type: str + sample: network + vpc_id: + description: The ID of the VPC for the load balancer. + returned: when state is present + type: str + sample: vpc-0011223344 ''' from ansible_collections.amazon.aws.plugins.module_utils.core import AnsibleAWSModule @@ -379,19 +385,18 @@ def create_or_update_elb(elb_obj): if listeners_obj.changed: elb_obj.changed = True + # Update ELB ip address type only if option has been provided + if elb_obj.module.params.get('ip_address_type') is not None: + elb_obj.modify_ip_address_type(elb_obj.module.params.get('ip_address_type')) + + # Update the objects to pickup changes # Get the ELB again elb_obj.update() - # Get the ELB listeners again listeners_obj.update() - # Update the ELB attributes elb_obj.update_elb_attributes() - # Update ELB ip address type only if option has been provided - if elb_obj.module.params.get('ip_address_type') is not None: - elb_obj.modify_ip_address_type(elb_obj.module.params.get('ip_address_type')) - # Convert to snake_case and merge in everything we want to return to the user snaked_elb = camel_dict_to_snake_dict(elb_obj.elb) snaked_elb.update(camel_dict_to_snake_dict(elb_obj.elb_attributes)) @@ -405,7 +410,10 @@ def create_or_update_elb(elb_obj): # ip address type snaked_elb['ip_address_type'] = elb_obj.get_elb_ip_address_type() - elb_obj.module.exit_json(changed=elb_obj.changed, **snaked_elb) + elb_obj.module.exit_json( + changed=elb_obj.changed, + load_balancer=snaked_elb, + **snaked_elb) def delete_elb(elb_obj): diff --git a/tests/integration/targets/elb_network_lb/aliases b/tests/integration/targets/elb_network_lb/aliases index 00f3632f6ee..4ef4b2067d0 100644 --- a/tests/integration/targets/elb_network_lb/aliases +++ b/tests/integration/targets/elb_network_lb/aliases @@ -1,6 +1 @@ -# reason: missing-policy -# reason: broken -# The SSL cert stored in the test has expired. Should be dynamically generated. -disabled - cloud/aws diff --git a/tests/integration/targets/elb_network_lb/defaults/main.yml b/tests/integration/targets/elb_network_lb/defaults/main.yml index 5ee3fa45379..83e9440412c 100644 --- a/tests/integration/targets/elb_network_lb/defaults/main.yml +++ b/tests/integration/targets/elb_network_lb/defaults/main.yml @@ -2,6 +2,6 @@ # load balancer and target group names have to be less than 32 characters # the 8 digit identifier at the end of resource_prefix helps determine during which test something # was created and allows tests to be run in parallel -nlb_name: "my-nlb-{{ resource_prefix | regex_search('([0-9]+)$') }}" -tg_name: "my-tg-{{ resource_prefix | regex_search('([0-9]+)$') }}" -tg_tcpudp_name: "my-tg-tcpudp-{{ resource_prefix | regex_search('([0-9]+)$') }}" +nlb_name: "nlb-{{ tiny_prefix }}" +tg_name: "nlb-{{ tiny_prefix }}" +tg_tcpudp_name: "nlb-tcp-udp-{{ tiny_prefix }}" diff --git a/tests/integration/targets/elb_network_lb/files/cert.pem b/tests/integration/targets/elb_network_lb/files/cert.pem deleted file mode 100644 index 81df3a6fa1c..00000000000 --- a/tests/integration/targets/elb_network_lb/files/cert.pem +++ /dev/null @@ -1,32 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFiTCCA3GgAwIBAgIJAKE+XLUKdWtPMA0GCSqGSIb3DQEBCwUAMFsxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQxFDASBgNVBAMMC2V4YW1wbGUuY29tMB4XDTE5MDYxNDEx -MzIzM1oXDTIwMDYxMzExMzIzM1owWzELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNv -bWUtU3RhdGUxITAfBgNVBAoMGEludGVybmV0IFdpZGdpdHMgUHR5IEx0ZDEUMBIG -A1UEAwwLZXhhbXBsZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC -AQDOFNh5eQ6+9tYvtzjrqvFDzPoXmZuOFeqFS7iBH4gLorvmQQIQcVEAH7O+tkhW -Z8+6PgvXXd43GFtEbY8jZoBQwupl7lIdzywFRoyZYkREXodmDixkwxlPvUWdrb3r -ZDRON6qIbX8LrzTPD1+JL4Rtkgr1RTlLrHT3ABEqEV1fQODOdbRd7rq6fmqwPlbl -zS5kN3RPFuJVDZrnCPcEMOA3QftQgDTzyOlZJYWDZsJxel7H/O9qZjPBTitNJxg1 -ierPaIXT6u6CdWA0A7t3Knyn2+vcyvemjsbQg9v/U5zKR3h+6F0slqgOT/ZnrEos -AzxdeaA5POJFy6xCHZiVgsE7OVaPB9imWrrAYbKsHVLP2rdlhnGZQnnebmTYCll5 -SvXWCIr5vp4i1qxIa95QBU/xmEY6kTy9GjAOSmYXj7UnwnBZwgEop0yUdBMb4s9G -x8S6Yxaj1DZVyiyrzInBri9lqabkPLPQNaK7wTKN5zl7r5pSCsF8rl4R+mvcxyyY -dS+cqseGjn98ubdd/vyQWqLbQtr5Njk4ROs5Rv6/2z/RUFdwsqB5aXztxOs3J7aJ -5ScTgmoK+wkQY+tej6H5pgT02vKuXLwe4wHKKAYepgH7Azkm7XoFlHhBEUy+uUsI -PMBm2Meo1JzOc8E5QqLX2YO/MDiZhI+NYOMJF0/huWqM7wIDAQABo1AwTjAdBgNV -HQ4EFgQU3cPtQEUQYkj4lTM5fbdkd8FSVVIwHwYDVR0jBBgwFoAU3cPtQEUQYkj4 -lTM5fbdkd8FSVVIwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEACWQX -CJK6f+/Zci1e7Gvw0gd+1xV8jbz2lH2zOGSpoQ6UCRVrANEX+p0nZZRpnTTrJfGa -Yx+TjIJ4SSoaCud+N2IGXWxzuMan+NskyycTaHSA/i6OwZ8jKki/iVvE5XQN+gHw -h5lWnEh5PiGG91lYi+FShUN0DX7Su776UK3mloLlq+ANCubWxDycWc0xBNH8iD2U -xBV7MfuCX9rSei+2NU+hnOPrzh0OKNGOTSPHY1N1KU3grxTLTpF8PTMHC55sEy2E -EMokRb3V/lFyrfX755KT5cQG6uQKQorI95BoxoNjeek54tuBUjenLfOH6dMO/6Xd -WaouLXiDM73fwFI0ByQ5CTJizC0ehoZtv2XB7yjZJEuI7zz4wXBBwgNlBV2j4aJJ -0wNG9210ZC7NxNH7MRfZfzLQpsOMTm9UP85TXsB1ieaN6OD2CnHP9O6umy633Aie -dsQt5yaC9+N86NBceb44IlkqlTv720BQjq7Dz5UCthhNg0VYpICzymD9kAKPfx9Z -1ug2gB4i2r6eHqFIexwSfa29DxW+KEPlL7pP9P9FVsYNyZYOvX8OgVERkA/9L53i -MpzRPPzTyjW/sJcDWVfrQU0NhPj5lOxdMcbvvU+KD3afraUXPiN4N4+FFWENOFZ/ -HEKjPj+As/3OHNyUXrCciYjq6gCLZ6SV945l2h8= ------END CERTIFICATE----- diff --git a/tests/integration/targets/elb_network_lb/files/key.pem b/tests/integration/targets/elb_network_lb/files/key.pem deleted file mode 100644 index 3b4da6feda5..00000000000 --- a/tests/integration/targets/elb_network_lb/files/key.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDOFNh5eQ6+9tYv -tzjrqvFDzPoXmZuOFeqFS7iBH4gLorvmQQIQcVEAH7O+tkhWZ8+6PgvXXd43GFtE -bY8jZoBQwupl7lIdzywFRoyZYkREXodmDixkwxlPvUWdrb3rZDRON6qIbX8LrzTP -D1+JL4Rtkgr1RTlLrHT3ABEqEV1fQODOdbRd7rq6fmqwPlblzS5kN3RPFuJVDZrn -CPcEMOA3QftQgDTzyOlZJYWDZsJxel7H/O9qZjPBTitNJxg1ierPaIXT6u6CdWA0 -A7t3Knyn2+vcyvemjsbQg9v/U5zKR3h+6F0slqgOT/ZnrEosAzxdeaA5POJFy6xC -HZiVgsE7OVaPB9imWrrAYbKsHVLP2rdlhnGZQnnebmTYCll5SvXWCIr5vp4i1qxI -a95QBU/xmEY6kTy9GjAOSmYXj7UnwnBZwgEop0yUdBMb4s9Gx8S6Yxaj1DZVyiyr -zInBri9lqabkPLPQNaK7wTKN5zl7r5pSCsF8rl4R+mvcxyyYdS+cqseGjn98ubdd -/vyQWqLbQtr5Njk4ROs5Rv6/2z/RUFdwsqB5aXztxOs3J7aJ5ScTgmoK+wkQY+te -j6H5pgT02vKuXLwe4wHKKAYepgH7Azkm7XoFlHhBEUy+uUsIPMBm2Meo1JzOc8E5 -QqLX2YO/MDiZhI+NYOMJF0/huWqM7wIDAQABAoICAB3iqAH1rE3FPgptZ7PFdnd+ -okYJ4KUaSIhMEtWm3PPTBay+gK4hwL1j240sohDlvRolJVJ2KmOTBKlHuhpIIxOT -MKrXhNEN2jRpproXpg7EJp6GL6ntIR6PNClJqOEaBvvQ1soyFtp67g2ZDSG34lyB -cVVgVI7E07F+MP8IxaGqpu9J4n48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u2WE7WT6/Rupus04XVXRR+Fb6DAGb -yw2MpB3kLvjugQpolx4YbXE4n+F1mkqm9fHjo4fbfSwjmeFnPsRvRmiRTomHxq/s -DUZ6eZM8TIlGhUrx/Y1TP0GQjKxDN6ZQ ------END PRIVATE KEY----- diff --git a/tests/integration/targets/elb_network_lb/meta/main.yml b/tests/integration/targets/elb_network_lb/meta/main.yml index 1471b11f658..fd89b0e4f82 100644 --- a/tests/integration/targets/elb_network_lb/meta/main.yml +++ b/tests/integration/targets/elb_network_lb/meta/main.yml @@ -1,2 +1,3 @@ dependencies: - setup_ec2_facts + - setup_remote_tmp_dir diff --git a/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml b/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml new file mode 100644 index 00000000000..3f668650e7b --- /dev/null +++ b/tests/integration/targets/elb_network_lb/tasks/generate-certs.yml @@ -0,0 +1,52 @@ +################################################ +# Setup SSL certs to store in IAM +################################################ +- name: 'Generate SSL Keys' + community.crypto.openssl_privatekey: + path: '{{ remote_tmp_dir }}/{{ item }}-key.pem' + size: 4096 + loop: + - 'ca' + - 'cert1' + +- name: 'Generate CSRs' + community.crypto.openssl_csr: + path: '{{ remote_tmp_dir }}/{{ item }}.csr' + privatekey_path: '{{ remote_tmp_dir }}/{{ item }}-key.pem' + common_name: '{{ item }}.ansible.test' + subject_alt_name: 'DNS:{{ item }}.ansible.test' + basic_constraints: + - 'CA:TRUE' + loop: + - 'ca' + - 'cert1' + +- name: 'Self-sign the "root"' + community.crypto.x509_certificate: + provider: selfsigned + path: '{{ remote_tmp_dir }}/ca.pem' + privatekey_path: '{{ remote_tmp_dir }}/ca-key.pem' + csr_path: '{{ remote_tmp_dir }}/ca.csr' + +- name: 'Sign the cert' + community.crypto.x509_certificate: + provider: ownca + path: '{{ remote_tmp_dir }}/cert1.pem' + csr_path: '{{ remote_tmp_dir }}/cert1.csr' + ownca_path: '{{ remote_tmp_dir }}/ca.pem' + ownca_privatekey_path: '{{ remote_tmp_dir }}/ca-key.pem' + +- set_fact: + path_ca_cert: '{{ remote_tmp_dir }}/ca.pem' + path_ca_key: '{{ remote_tmp_dir }}/ca-key.pem' + path_cert_pem: '{{ remote_tmp_dir }}/cert1.pem' + path_cert_key: '{{ remote_tmp_dir }}/cert1-key.pem' + + +- name: create certificate + iam_server_certificate: + name: 'nlb_{{ tiny_prefix }}' + state: present + cert: "{{ lookup('file', path_cert_pem) }}" + key: "{{ lookup('file', path_cert_key) }}" + register: cert diff --git a/tests/integration/targets/elb_network_lb/tasks/main.yml b/tests/integration/targets/elb_network_lb/tasks/main.yml index 65d0df9dfaf..43089ff93cb 100644 --- a/tests/integration/targets/elb_network_lb/tasks/main.yml +++ b/tests/integration/targets/elb_network_lb/tasks/main.yml @@ -10,13 +10,7 @@ region: '{{ aws_region }}' block: - - name: create certificate - iam_server_certificate: - name: test_cert - state: present - cert: "{{ lookup('file', 'cert.pem') }}" - key: "{{ lookup('file', 'key.pem') }}" - register: cert + - include_tasks: generate-certs.yml - name: create VPC ec2_vpc_net: @@ -243,6 +237,10 @@ - name: destroy certificate iam_server_certificate: - name: test_cert + name: 'nlb_{{ tiny_prefix }}' state: absent + register: remove_cert ignore_errors: yes + retries: 10 + delay: 5 + until: remove_cert is success diff --git a/tests/integration/targets/elb_network_lb/tasks/test_nlb_ip_address_type_option.yml b/tests/integration/targets/elb_network_lb/tasks/test_nlb_ip_address_type_option.yml index 3baa453ac82..0399e58b1c3 100644 --- a/tests/integration/targets/elb_network_lb/tasks/test_nlb_ip_address_type_option.yml +++ b/tests/integration/targets/elb_network_lb/tasks/test_nlb_ip_address_type_option.yml @@ -34,7 +34,7 @@ - Type: forward TargetGroupName: "{{ tg_name }}" ip_address_type: "dualstack" - ignore_errors: true + wait: true register: nlb - assert: @@ -53,7 +53,7 @@ - Type: forward TargetGroupName: "{{ tg_name }}" ip_address_type: "ipv4" - ignore_errors: true + wait: true register: nlb - assert: @@ -73,7 +73,7 @@ - Type: forward TargetGroupName: "{{ tg_name }}" ip_address_type: "ipv4" - ignore_errors: true + wait: true register: nlb - assert: