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

Make deprecated updates in dynamodbo_table module fail #837

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
breaking_changes:
- dynamodb_table - deprecated updates currently ignored for primary keys and global_all indexes will now result in a failure.
(https://github.com/ansible-collections/community.aws/pull/837).
13 changes: 3 additions & 10 deletions plugins/modules/dynamodb_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,9 @@ def _generate_index(index, include_throughput=True):
projection['NonKeyAttributes'] = non_key_attributes
else:
if non_key_attributes:
module.deprecate(
module.fail_json(
"DynamoDB does not support specifying non-key-attributes ('includes') for "
"indexes of type 'all'. Attempts to set this attributes are currently "
"ignored, but in future will result in a failure. "
"Index name: {0}".format(index['name']),
version='3.0.0', collection_name='community.aws')
"indexes of type 'all'. Index name: {0}".format(index['name']))

idx = dict(
IndexName=index['name'],
Expand Down Expand Up @@ -857,11 +854,7 @@ def _update_tags(current_table):
def update_table(current_table):
primary_index_changes = _primary_index_changes(current_table)
if primary_index_changes:
module.deprecate("DynamoDB does not support updating the Primary keys on a table. "
"Attempts to change the keys are currently ignored, but in future will "
"result in a failure. "
"Changed paramters are {0}".format(primary_index_changes),
version='3.0.0', collection_name='community.aws')
module.fail_json("DynamoDB does not support updating the Primary keys on a table. Changed paramters are: {0}".format(primary_index_changes))

changed = False
changed |= _update_table(current_table)
Expand Down
17 changes: 14 additions & 3 deletions tests/integration/targets/dynamodb_table/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
table_name: "{{ resource_prefix }}"
table_name_on_demand: "{{ resource_prefix }}-pay-per-request"
table_name_on_demand_complex: "{{ resource_prefix }}-pay-per-request-complex"

table_index: "id"
table_index_type: "NUMBER"
Expand All @@ -22,13 +23,23 @@ indexes:
type: global_all
hash_key_name: foo
range_key_name: bar
includes:
- another_field
- another_field2
read_capacity: 5
write_capacity: 5

indexes_pay_per_request:
- name: NamedIndex
type: global_include
hash_key_name: idx
range_key_name: create_time
includes:
- other_field
- other_field2
- name: AnotherIndex
type: global_all
hash_key_name: foo
range_key_name: bar

indexes_pay_per_request_bad:
- name: NamedIndex
type: global_include
hash_key_name: idx
Expand Down
Loading