From 00d073be697295ff0ad6c9f9ec78b849e102ad8b Mon Sep 17 00:00:00 2001 From: Damien Levac Date: Fri, 5 Mar 2021 12:12:25 -0500 Subject: [PATCH 1/4] Added support for 'vpc_endpoint_type'. --- plugins/modules/ec2_vpc_endpoint.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plugins/modules/ec2_vpc_endpoint.py b/plugins/modules/ec2_vpc_endpoint.py index 28d0fda0eba..d775634faba 100644 --- a/plugins/modules/ec2_vpc_endpoint.py +++ b/plugins/modules/ec2_vpc_endpoint.py @@ -21,6 +21,12 @@ - Required when creating a VPC endpoint. required: false type: str + vpc_endpoint_type: + description: + - The type of endpoint. + required: false + default: Gateway + type: str service: description: - An AWS supported vpc endpoint service. Use the M(community.aws.ec2_vpc_endpoint_info) @@ -251,6 +257,7 @@ def create_vpc_endpoint(client, module): changed = False token_provided = False params['VpcId'] = module.params.get('vpc_id') + params['VpcEndpointType'] = module.params.get('vpc_endpoint_type') params['ServiceName'] = module.params.get('service') params['DryRun'] = module.check_mode @@ -334,6 +341,7 @@ def setup_removal(client, module): def main(): argument_spec = dict( vpc_id=dict(), + vpc_endpoint_type=dict(default='Gateway', choices=['Interface', 'Gateway', 'GatewayLoadBalancer']), service=dict(), policy=dict(type='json'), policy_file=dict(type='path', aliases=['policy_path']), From f7768a5f4adcd95e19004b3af30398928c58d2ab Mon Sep 17 00:00:00 2001 From: Damien Levac Date: Fri, 5 Mar 2021 12:43:16 -0500 Subject: [PATCH 2/4] Integration test for the 'vpc_endpoint_type' feature. --- .../targets/ec2_vpc_endpoint/tasks/main.yml | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/integration/targets/ec2_vpc_endpoint/tasks/main.yml b/tests/integration/targets/ec2_vpc_endpoint/tasks/main.yml index d06ac92fa01..a8fdbec889d 100644 --- a/tests/integration/targets/ec2_vpc_endpoint/tasks/main.yml +++ b/tests/integration/targets/ec2_vpc_endpoint/tasks/main.yml @@ -353,6 +353,26 @@ that: - endpoint_delete_check is not changed + - name: Create interface endpoint + ec2_vpc_endpoint: + state: present + vpc_id: '{{ vpc_id }}' + service: '{{ endpoint_service_a }}' + vpc_endpoint_type: Interface + register: create_interface_endpoint + - name: Check that the interface endpoint was created properly + assert: + that: + - create_interface_endpoint is changed + - create_interface_endpoint.result.vpc_endpoint_type == "Interface" + - name: Delete interface endpoint + ec2_vpc_endpoint: + state: absent + vpc_endpoint_id: "{{ create_interface_endpoint.result.vpc_endpoint_id }}" + register: interface_endpoint_delete_check + - assert: + that: + - interface_endpoint_delete_check is changed # ============================================================ # BEGIN POST-TEST CLEANUP From af4c2a46d9e1ed993b8ba4ca0720ffa9b4f6df64 Mon Sep 17 00:00:00 2001 From: Damien Levac Date: Fri, 5 Mar 2021 13:38:33 -0500 Subject: [PATCH 3/4] Added choices in documentation. --- plugins/modules/ec2_vpc_endpoint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/ec2_vpc_endpoint.py b/plugins/modules/ec2_vpc_endpoint.py index d775634faba..d7d10769f06 100644 --- a/plugins/modules/ec2_vpc_endpoint.py +++ b/plugins/modules/ec2_vpc_endpoint.py @@ -26,6 +26,7 @@ - The type of endpoint. required: false default: Gateway + choices: [ "Interface", "Gateway", "GatewayLoadBalancer" ] type: str service: description: @@ -62,7 +63,7 @@ - absent to remove resource required: false default: present - choices: [ "present", "absent"] + choices: [ "present", "absent" ] type: str wait: description: From 7e7664bdec644432c8f8aba984358747e7192656 Mon Sep 17 00:00:00 2001 From: Damien Levac Date: Fri, 5 Mar 2021 15:18:00 -0500 Subject: [PATCH 4/4] Added changelog. --- changelogs/fragments/460-add-support-for-vpc-endpoint-type.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/460-add-support-for-vpc-endpoint-type.yml diff --git a/changelogs/fragments/460-add-support-for-vpc-endpoint-type.yml b/changelogs/fragments/460-add-support-for-vpc-endpoint-type.yml new file mode 100644 index 00000000000..eb53ad4224b --- /dev/null +++ b/changelogs/fragments/460-add-support-for-vpc-endpoint-type.yml @@ -0,0 +1,2 @@ +minor_changes: + - Added support for specifying 'vpc_endpoint_type' in module 'ec2_vpc_endpoint'.