From 35fd50729e4267a332534a287febf41641850afc Mon Sep 17 00:00:00 2001 From: Mark Chappell Date: Mon, 24 Oct 2022 15:43:52 +0200 Subject: [PATCH] ec2_vpc_endpoint - Remove policy_file parameter (#1195) ec2_vpc_endpoint - Remove policy_file parameter SUMMARY fixes: #1178 Drops the previously deprecated policy_file parameter. ISSUE TYPE Feature Pull Request COMPONENT NAME ec2_vpc_endpoint ADDITIONAL INFORMATION Reviewed-by: Alina Buzachis --- .../fragments/20221024-ec2_vpc_endpoint.yml | 2 + plugins/modules/ec2_vpc_endpoint.py | 42 +------------------ tests/sanity/ignore-2.11.txt | 1 - tests/sanity/ignore-2.12.txt | 1 - tests/sanity/ignore-2.13.txt | 1 - tests/sanity/ignore-2.14.txt | 1 - tests/sanity/ignore-2.15.txt | 1 - tests/sanity/ignore-2.9.txt | 1 - 8 files changed, 4 insertions(+), 46 deletions(-) create mode 100644 changelogs/fragments/20221024-ec2_vpc_endpoint.yml diff --git a/changelogs/fragments/20221024-ec2_vpc_endpoint.yml b/changelogs/fragments/20221024-ec2_vpc_endpoint.yml new file mode 100644 index 00000000000..a8853392b2a --- /dev/null +++ b/changelogs/fragments/20221024-ec2_vpc_endpoint.yml @@ -0,0 +1,2 @@ +breaking_changes: +- ec2_vpc_endpoint - the ``policy_file`` parameter has been removed. I(policy) with a file lookup can be used instead (https://github.com/ansible-collections/amazon.aws/issues/1178). diff --git a/plugins/modules/ec2_vpc_endpoint.py b/plugins/modules/ec2_vpc_endpoint.py index fd62dea8658..244a6d42e8d 100644 --- a/plugins/modules/ec2_vpc_endpoint.py +++ b/plugins/modules/ec2_vpc_endpoint.py @@ -55,24 +55,10 @@ description: - A properly formatted JSON policy as string, see U(https://github.com/ansible/ansible/issues/7005#issuecomment-42894813). - Cannot be used with I(policy_file). - Option when creating an endpoint. If not provided AWS will utilise a default policy which provides full access to the service. required: false type: json - policy_file: - description: - - The path to the properly json formatted policy file, see - U(https://github.com/ansible/ansible/issues/7005#issuecomment-42894813) - on how to use it properly. Cannot be used with I(policy). - - Option when creating an endpoint. If not provided AWS will - utilise a default policy which provides full access to the service. - - This option has been deprecated and will be removed in release 6.0.0 - to maintain the existing functionality please use the I(policy) option - and a file lookup. - required: false - aliases: [ "policy_path" ] - type: path state: description: - C(present) to ensure resource is created. @@ -122,6 +108,8 @@ - Karen Cheng (@Etherdaemon) notes: - Support for I(tags) and I(purge_tags) was added in release 1.5.0. + - The C(policy_file) paramater was removed in release 6.0.0 please use the + I(policy) option and a file lookup instead. extends_documentation_fragment: - amazon.aws.aws - amazon.aws.ec2 @@ -155,18 +143,6 @@ - rtb-87654321 register: new_vpc_endpoint -- name: Create new vpc endpoint with json file - amazon.aws.ec2_vpc_endpoint: - state: present - region: ap-southeast-2 - vpc_id: vpc-12345678 - service: com.amazonaws.ap-southeast-2.s3 - policy_file: "{{ role_path }}/files/endpoint_policy.json" - route_table_ids: - - rtb-12345678 - - rtb-87654321 - register: new_vpc_endpoint - - name: Delete newly created vpc endpoint amazon.aws.ec2_vpc_endpoint: state: absent @@ -333,14 +309,6 @@ def create_vpc_endpoint(client, module): module.fail_json(msg=str(e), exception=traceback.format_exc(), **camel_dict_to_snake_dict(e.response)) - elif module.params.get('policy_file'): - try: - with open(module.params.get('policy_file'), 'r') as json_data: - policy = json.load(json_data) - except (OSError, json.JSONDecodeError) as e: - module.fail_json(msg=str(e), exception=traceback.format_exc(), - **camel_dict_to_snake_dict(e.response)) - if policy: params['PolicyDocument'] = json.dumps(policy) @@ -421,7 +389,6 @@ def main(): vpc_endpoint_subnets=dict(type='list', elements='str'), service=dict(), policy=dict(type='json'), - policy_file=dict(type='path', aliases=['policy_path']), state=dict(default='present', choices=['present', 'absent']), wait=dict(type='bool', default=False), wait_timeout=dict(type='int', default=320, required=False), @@ -434,7 +401,6 @@ def main(): module = AnsibleAWSModule( argument_spec=argument_spec, supports_check_mode=True, - mutually_exclusive=[['policy', 'policy_file']], required_if=[ ['state', 'present', ['vpc_id', 'service']], ['state', 'absent', ['vpc_endpoint_id']], @@ -444,10 +410,6 @@ def main(): # Validate Requirements state = module.params.get('state') - if module.params.get('policy_file'): - module.deprecate('The policy_file option has been deprecated', - version='6.0.0', collection_name='amazon.aws') - if module.params.get('vpc_endpoint_type'): if module.params.get('vpc_endpoint_type') == 'Gateway': if module.params.get('vpc_endpoint_subnets') or module.params.get('vpc_endpoint_security_groups'): diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt index c6474f79543..52ef952085c 100644 --- a/tests/sanity/ignore-2.11.txt +++ b/tests/sanity/ignore-2.11.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1177 -plugins/modules/ec2_vpc_endpoint.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1178 plugins/modules/ec2_vpc_endpoint_info.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1179 plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this plugins/modules/route53_health_check.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1111 diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt index c6474f79543..52ef952085c 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.12.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1177 -plugins/modules/ec2_vpc_endpoint.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1178 plugins/modules/ec2_vpc_endpoint_info.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1179 plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this plugins/modules/route53_health_check.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1111 diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt index c6474f79543..52ef952085c 100644 --- a/tests/sanity/ignore-2.13.txt +++ b/tests/sanity/ignore-2.13.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1177 -plugins/modules/ec2_vpc_endpoint.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1178 plugins/modules/ec2_vpc_endpoint_info.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1179 plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this plugins/modules/route53_health_check.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1111 diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index c6474f79543..52ef952085c 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1177 -plugins/modules/ec2_vpc_endpoint.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1178 plugins/modules/ec2_vpc_endpoint_info.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1179 plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this plugins/modules/route53_health_check.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1111 diff --git a/tests/sanity/ignore-2.15.txt b/tests/sanity/ignore-2.15.txt index c6474f79543..52ef952085c 100644 --- a/tests/sanity/ignore-2.15.txt +++ b/tests/sanity/ignore-2.15.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1177 -plugins/modules/ec2_vpc_endpoint.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1178 plugins/modules/ec2_vpc_endpoint_info.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1179 plugins/modules/route53.py validate-modules:parameter-state-invalid-choice # route53_info needs improvements before we can deprecate this plugins/modules/route53_health_check.py pylint:collection-deprecated-version # https://github.com/ansible-collections/amazon.aws/issues/1111 diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt index a759e92db4a..05114d1feaa 100644 --- a/tests/sanity/ignore-2.9.txt +++ b/tests/sanity/ignore-2.9.txt @@ -1,5 +1,4 @@ plugins/modules/ec2_vpc_dhcp_option.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability -plugins/modules/ec2_vpc_endpoint.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability plugins/modules/ec2_vpc_endpoint_info.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability plugins/modules/ec2_instance.py pylint:ansible-deprecated-no-version # We use dates for deprecations, Ansible 2.9 only supports this for compatability plugins/modules/iam_policy.py pylint:ansible-deprecated-no-version