Skip to content

Commit

Permalink
ec2_vpc_endpoint - Remove policy_file parameter (#1195)
Browse files Browse the repository at this point in the history
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 <None>
  • Loading branch information
tremble authored Oct 24, 2022
1 parent 8314c2d commit 35fd507
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 46 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20221024-ec2_vpc_endpoint.yml
Original file line number Diff line number Diff line change
@@ -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).
42 changes: 2 additions & 40 deletions plugins/modules/ec2_vpc_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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),
Expand All @@ -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']],
Expand All @@ -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'):
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.11.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.12.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.13.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.14.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.15.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion tests/sanity/ignore-2.9.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 35fd507

Please sign in to comment.