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

[PR #2063/4752c05c backport][stable-8] Add support to enable multicast on transit gateway #2119

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/2063-add-multicast-support.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- ec2_transit_gateway - Support for enable multicast on Transit Gateway (https://github.com/ansible-collections/community.aws/pull/2063).
3 changes: 3 additions & 0 deletions plugins/module_utils/transitgateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ def _set_option(self, name, value):
def set_dns_support(self, value):
return self._set_option("DnsSupport", value)

def set_multicast_support(self, value):
return self._set_option("MulticastSupport", value)

def set_ipv6_support(self, value):
return self._set_option("Ipv6Support", value)

Expand Down
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 }}"
Loading