Skip to content

Commit

Permalink
Add support to enable multicast on transit gateway (ansible-collectio…
Browse files Browse the repository at this point in the history
…ns#2063)

SUMMARY

Need to enable multicast while creating transit gateway

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

transit_gateway
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis
Reviewed-by: Bikouo Aubin
Reviewed-by: Carlos Schimidt
Reviewed-by: Mark Chappell

This commit was initially merged in https://github.com/ansible-collections/community.aws
See: ansible-collections/community.aws@4752c05
  • Loading branch information
cschimid authored and mandar242 committed Oct 23, 2024
1 parent fba239d commit a8d4c43
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 2 deletions.
14 changes: 14 additions & 0 deletions plugins/modules/ec2_transit_gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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"]),
Expand Down
7 changes: 7 additions & 0 deletions plugins/modules/ec2_transit_gateway_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 32 additions & 2 deletions tests/integration/targets/ec2_transit_gateway/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 }}"

0 comments on commit a8d4c43

Please sign in to comment.