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

Conversation

mandar242
Copy link
Contributor

@mandar242 mandar242 commented Oct 13, 2022

SUMMARY

Fixes #1074

Added a check to WARN the task while modifying/updating rds_param_group if task tries to change DB parameter group family.

As AWS Documentation specifies that,

The DB parameter group family can't be changed when updating a DB parameter group.
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

rds_param_group

ADDITIONAL INFORMATION

Steps to reproduce

  1. Create rds Param group
- name: Create a param group
  hosts: localhost
  gather_facts: false
  tasks:
    - name: create test rds db parameter group
      amazon.aws.rds_param_group:
        name: "test-parameter-group"
        description: test rpg
        state: present
        engine: "aurora-postgresql13"
  1. Try to change engine (family), with the fix in PR task should throw warning.
- name: Create a param group
  hosts: localhost
  gather_facts: false
  tasks:
    - name: create test rds db parameter group
      amazon.aws.rds_param_group:
        name: "test-parameter-group"
        description: test rpg
        state: present
        engine: "aurora-postgresql14"

@github-actions
Copy link

github-actions bot commented Oct 13, 2022

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug community_review integration tests/integration module module needs_triage plugins plugin (any type) tests tests labels Oct 13, 2022
@softwarefactory-project-zuul

This comment was marked as outdated.

@softwarefactory-project-zuul

This comment was marked as outdated.

db_parameter_group_family = group['DBParameterGroupFamily']

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

@alinabuzachis alinabuzachis Oct 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It the API doesn't originally fail, wouldn't it make more sense to only warn instead of fail? It there isn't any other update to do, it would show up the warning and changed=False. This is only a suggestion.

What do you think @mandar242 @tremble @jillr ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alinabuzachis that seems reasonable, I was going back and forth on this but later decided to fail on it
as there could be case where user wants to update more parameter (modifiable) along with DBParameterGroupFamily, if we give a warn instead of fail, and modify parameters that are possible, it could be easily misunderstood as original reported has mentioned that DBParameterGroupFamily is also changed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be really clear that this is an immutable option in the docs (I added a small suggestion) and then give the user a warning, that way we don't introduce a breaking change and we're consistent with the API.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alinabuzachis, as @jillr suggested, changed the failure to warning, to avoid introducing breaking changes.
Now the task shows a warning as below

TASK [rds_param_group : test modifying rds parameter group engine/family] ******
[WARNING]: The DB parameter group family (engine) can't be changed when
updating a DB parameter group.
ok: [testhost] => {"changed": false .....

plugins/modules/rds_param_group.py Outdated Show resolved Hide resolved
db_parameter_group_family = group['DBParameterGroupFamily']

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's be really clear that this is an immutable option in the docs (I added a small suggestion) and then give the user a warning, that way we don't introduce a breaking change and we're consistent with the API.

@mandar242 mandar242 changed the title rds_param_group: Fail on updating DBParameterGroupFamily (engine) rds_param_group: WARN on updating DBParameterGroupFamily (engine) Oct 18, 2022
@mandar242 mandar242 requested a review from jillr October 18, 2022 18:57
@softwarefactory-project-zuul

This comment was marked as outdated.

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 4m 07s
✔️ build-ansible-collection SUCCESS in 5m 08s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 8m 42s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 8m 47s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 8m 20s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 33s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 7m 03s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 6m 22s
✔️ cloud-tox-py3 SUCCESS in 3m 01s
✔️ ansible-test-splitter SUCCESS in 3m 02s
✔️ integration-amazon.aws-1 SUCCESS in 5m 57s
⚠️ integration-amazon.aws-2 SKIPPED
⚠️ integration-amazon.aws-3 SKIPPED
⚠️ integration-amazon.aws-4 SKIPPED
⚠️ integration-amazon.aws-5 SKIPPED
⚠️ integration-amazon.aws-6 SKIPPED
⚠️ integration-amazon.aws-7 SKIPPED
⚠️ integration-amazon.aws-8 SKIPPED
⚠️ integration-amazon.aws-9 SKIPPED
⚠️ integration-amazon.aws-10 SKIPPED
⚠️ integration-amazon.aws-11 SKIPPED
⚠️ integration-amazon.aws-12 SKIPPED
⚠️ integration-amazon.aws-13 SKIPPED
⚠️ integration-amazon.aws-14 SKIPPED
⚠️ integration-amazon.aws-15 SKIPPED
⚠️ integration-amazon.aws-16 SKIPPED
⚠️ integration-amazon.aws-17 SKIPPED
⚠️ integration-amazon.aws-18 SKIPPED
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
✔️ ansible-test-changelog SUCCESS in 2m 38s

@jillr jillr added the mergeit Merge the PR (SoftwareFactory) label Oct 20, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 38s
✔️ build-ansible-collection SUCCESS in 5m 30s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 9m 34s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 11m 00s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 9m 39s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 05s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 5m 53s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 7m 21s
✔️ cloud-tox-py3 SUCCESS in 3m 14s
✔️ ansible-test-splitter SUCCESS in 3m 53s
✔️ integration-amazon.aws-1 SUCCESS in 7m 07s
⚠️ integration-amazon.aws-2 SKIPPED
⚠️ integration-amazon.aws-3 SKIPPED
⚠️ integration-amazon.aws-4 SKIPPED
⚠️ integration-amazon.aws-5 SKIPPED
⚠️ integration-amazon.aws-6 SKIPPED
⚠️ integration-amazon.aws-7 SKIPPED
⚠️ integration-amazon.aws-8 SKIPPED
⚠️ integration-amazon.aws-9 SKIPPED
⚠️ integration-amazon.aws-10 SKIPPED
⚠️ integration-amazon.aws-11 SKIPPED
⚠️ integration-amazon.aws-12 SKIPPED
⚠️ integration-amazon.aws-13 SKIPPED
⚠️ integration-amazon.aws-14 SKIPPED
⚠️ integration-amazon.aws-15 SKIPPED
⚠️ integration-amazon.aws-16 SKIPPED
⚠️ integration-amazon.aws-17 SKIPPED
⚠️ integration-amazon.aws-18 SKIPPED
⚠️ integration-community.aws-1 SKIPPED
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
✔️ ansible-test-changelog SUCCESS in 2m 21s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 8110a16 into ansible-collections:main Oct 20, 2022
@mandar242 mandar242 deleted the rds_param_group branch May 9, 2023 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug community_review integration tests/integration mergeit Merge the PR (SoftwareFactory) module module plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rds_param_group doesn't check DBParameterGroupFamily
5 participants