diff --git a/plugins/modules/ec2_transit_gateway.py b/plugins/modules/ec2_transit_gateway.py index 19876984dba..c3a1079e5c9 100644 --- a/plugins/modules/ec2_transit_gateway.py +++ b/plugins/modules/ec2_transit_gateway.py @@ -42,6 +42,11 @@ - Whether to enable AWS DNS support. default: true type: bool + multicast_support: + description: + - Whether to enable AWS Multicast support. Valid only at the time of creation of the Transit Gateway. + type: bool + version_added: 8.1.0 state: description: - C(present) to ensure resource is created. @@ -91,6 +96,7 @@ asn: 64514 auto_associate: false auto_propagate: false + multicast_support: true dns_support: true description: "nonprod transit gateway" purge_tags: false @@ -181,6 +187,12 @@ returned: always type: str sample: enable + multicast_support: + description: Indicates whether Multicast support is enabled. + returned: always + type: str + sample: enable + version_added: 7.3.0 owner_id: description: The account that owns the transit gateway. returned: always @@ -362,6 +374,7 @@ def create_tgw(self, description): options["DefaultRouteTablePropagation"] = self.enable_option_flag(self._module.params.get("auto_propagate")) options["VpnEcmpSupport"] = self.enable_option_flag(self._module.params.get("vpn_ecmp_support")) options["DnsSupport"] = self.enable_option_flag(self._module.params.get("dns_support")) + options["MulticastSupport"] = self.enable_option_flag(self._module.params.get("multicast_support")) try: response = self._connection.create_transit_gateway(Description=description, Options=options) @@ -482,6 +495,7 @@ def setup_module_object(): auto_attach=dict(type="bool", default=False), auto_propagate=dict(type="bool", default=True), description=dict(type="str"), + multicast_support=dict(type="bool"), dns_support=dict(type="bool", default=True), purge_tags=dict(type="bool", default=True), state=dict(default="present", choices=["present", "absent"]), diff --git a/plugins/modules/ec2_transit_gateway_info.py b/plugins/modules/ec2_transit_gateway_info.py index b25346b84b8..014c875b6a0 100644 --- a/plugins/modules/ec2_transit_gateway_info.py +++ b/plugins/modules/ec2_transit_gateway_info.py @@ -119,6 +119,13 @@ returned: always type: str sample: "enable" + multicast_support: + description: + - Indicates whether Multicast support is enabled. + returned: always + type: str + sample: "enable" + version_added: 7.3.0 propagation_default_route_table_id: description: - The ID of the default propagation route table. diff --git a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml index c7353cfc0a6..241c9c2c324 100644 --- a/tests/integration/targets/ec2_transit_gateway/tasks/main.yml +++ b/tests/integration/targets/ec2_transit_gateway/tasks/main.yml @@ -22,7 +22,7 @@ assert: that: - create_result.changed == True - + - name: test update transit gateway with tags by description ec2_transit_gateway: description: "{{ tgw_description }}" @@ -75,6 +75,32 @@ assert: that: - result.changed == False + + - name: generate unique value for testing + set_fact: + tgw_description_multicast: "{{ resource_prefix }}-tgw-multicast" + + - name: test create transit gateway with multicast enabled + ec2_transit_gateway: + description: "{{ tgw_description_multicast }}" + multicast_support: true + register: create_result + + - name: assert changed is True + assert: + that: + - create_result.changed == True + + - name: test success with filter + ec2_transit_gateway_info: + filters: + options.multicast-support: enable + register: result + + - name: assert success with multicast-support filter + assert: + that: + - 'result.transit_gateways != []' # ==== Combine ec2_transit_gateway_info ====================== - name: test success with no parameters @@ -129,10 +155,14 @@ that: - 'result.changed == false' - 'result.transit_gateways != []' + always: ###### TEARDOWN STARTS HERE ###### - name: delete transit gateway ec2_transit_gateway: - description: "{{ tgw_description }}" + description: "{{ item }}" state: absent ignore_errors: yes + loop: + - "{{ tgw_description }}" + - "{{ tgw_description_multicast }}"