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

rds_param_group: WARN on updating DBParameterGroupFamily (engine) #1169

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,2 @@
bugfixes:
- rds_param_group - added a check to fail the task while modifying/updating rds_param_group if trying to change DB parameter group family. (https://github.com/ansible-collections/amazon.aws/pull/1169).
7 changes: 7 additions & 0 deletions plugins/modules/rds_param_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
- The type of database for this group.
- Please use following command to get list of all supported db engines and their respective versions.
- '# aws rds describe-db-engine-versions --query "DBEngineVersions[].DBParameterGroupFamily"'
- The DB parameter group family is immutable and can't be changed when updating a DB parameter group.
See U(https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-rds-dbparametergroup.html)
- Required for I(state=present).
type: str
immediate:
Expand Down Expand Up @@ -266,6 +268,11 @@ def ensure_present(module, connection):
module.fail_json_aws(e, msg="Couldn't create parameter group")
else:
group = response['DBParameterGroups'][0]
db_parameter_group_family = group['DBParameterGroupFamily']

if module.params.get('engine') != db_parameter_group_family:
module.warn("The DB parameter group family (engine) can't be changed when updating a DB parameter group.")

if tags:
changed = update_tags(module, connection, group, tags)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ rds_param_group:
name: '{{ resource_prefix}}rds-param-group'
description: Test group for rds_param_group Ansible module
engine: postgres9.6
engine_to_modify_to: postgres10

rds_long_param_list:
application_name: Test
Expand Down
21 changes: 21 additions & 0 deletions tests/integration/targets/rds_param_group/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,27 @@
- result.tags["Test"] == '123'

# ============================================================

- name: test modifying rds parameter group engine/family (warning displayed)
rds_param_group:
name: '{{ rds_param_group.name }}'
engine: '{{ rds_param_group.engine_to_modify_to }}'
description: '{{ rds_param_group.description }}'
state: present
tags:
Environment: test
Test: 123
register: result

- name: verify that modifying rds param group engine/family displays warning
assert:
that:
- not result.changed
- not result.failed
- result.warnings is defined
- result.warnings | length > 0

# ============================================================
- name: test tagging existing group - CHECK_MODE
rds_param_group:
name: '{{ rds_param_group.name }}'
Expand Down