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

fix: update parameter group to fix name vs. name_prefix #304

Merged

Conversation

bryantbiggs
Copy link
Member

@bryantbiggs bryantbiggs commented Mar 8, 2021

Description

  • remove 2nd resource in parameter_group sub-module and instead use a variable flag to determine whether or not to use a unique prefix on the name; this matches what was done in the option_group sub-module
  • remove use of var.identifier from sub-module and instead rely on var.parameter_group_name provided
  • update example/option-groups -> option/groups to test/validate changes to option and parameter groups outside of creating RDS instances

Motivation and Context

  • working towards consistent use of name versus name_prefix for the sub-modules as well as the root module (subnet group will be next and last update required now that option group is done + this PR)

Relates to #121

Breaking Changes

yes; albeit minor since again, parameter groups can be re-created without disruption (create_before_destroy is used here)

For users who are looking to upgrade, they will need to perform the following changes if they wish to forgo the re-creation:

If using without the name-prefix for parameter groups:

  • terraform state mv module.<your_module_name>.db_parameter_group.this_no_prefix module.<your_module_name>.db_parameter_group.this

How Has This Been Tested?

  • I have tested and validated these changes using one or more of the provided examples/* projects
  • Tested and validated using the update examples/groups directory

@bryantbiggs bryantbiggs force-pushed the fix/parameter-group branch from dbcd26a to ab0d63c Compare March 8, 2021 23:33
@bryantbiggs bryantbiggs requested a review from antonbabenko March 8, 2021 23:38
@antonbabenko antonbabenko merged commit 8dac72e into terraform-aws-modules:master Mar 9, 2021
@antonbabenko
Copy link
Member

v2.25.0 has been just released.

@atrakic
Copy link

atrakic commented Mar 9, 2021

I didn't have much time to see why CI failed all of sudden so as quick fix, I've ended up to pin version = "2.23.0". Hope it helps to somebody.

@atrakic
Copy link

atrakic commented Mar 9, 2021

BTW: Just tried to bump to latest version with option: create_db_option_group = false but after removing state:

terraform get
terraform state rm "module.rds.module.db_option_group.aws_db_option_group.this[0]"

my run ends with:

Error: Error in function call

  on .terraform/modules/rds/main.tf line 8, in locals:
   8:   option_group           = var.engine != "postgres" ? coalesce(module.db_option_group.this_db_option_group_id, var.option_group_name) : null
    |----------------
    | module.db_option_group.this_db_option_group_id is ""
    | var.option_group_name is ""

Call to function "coalesce" failed: no non-null, non-empty-string arguments.


Error: first character of parameter group "name_prefix" must be a letter

  on .terraform/modules/rds/modules/db_parameter_group/main.tf line 12, in resource "aws_db_parameter_group" "this":
  12:   name_prefix = local.name_prefix

Comment: coalesce() supports default values, maybe should be used here?

@bryantbiggs
Copy link
Member Author

hi @atrakic, I have opened a PR that should do two things that have been identified:

  • if you do not provide a name for the option group or parameter group, it will default back to the previous default of ${var.identifier}-
  • if you elect to not create an option group or parameter group, nor provide a name of an existing option/parameter group - it will default to pulling the default groups provided by AWS

I've updated the two examples to show and validate this
#308

@atrakic
Copy link

atrakic commented Mar 10, 2021

@bryantbiggs Yes, after second attempt I was able to bump to latest with:

...
create_db_subnet_group = true ## already created and runs, leave it as it is
  parameters = [
    {
      name  = "character_set_client"
      value = "utf8"
    },
    {
      name  = "character_set_server"
      value = "utf8"
    }
  ]

  options = [
    {
      option_name = "MARIADB_AUDIT_PLUGIN"

      option_settings = [
        {
          name  = "SERVER_AUDIT_EVENTS"
          value = "CONNECT"
        },
        {
          name  = "SERVER_AUDIT_FILE_ROTATIONS"
          value = "37"
        },
      ]
    },
  ]

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants