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

feat: Fix serverless v2 engine and add missing resource arguments #317

Merged

Conversation

bryantbiggs
Copy link
Member

@bryantbiggs bryantbiggs commented Aug 30, 2022

Description

  • Add support for RDS multi-AZ clusters that do not utilize the Aurora engine
    • Added support for availability_zones, db_cluster_instance_class, iops, storage_type, and allocated_storage to support RDS multi-AZ
    • Add example to demonstrate RDS multi-AZ usage
  • Add support for using cluster_identifier_prefix by adding cluster_use_name_prefix variable
  • Add cluster_members argument/variable
  • Fix serverless v2 scaling which is only valid when engine_mode == "provisioned" for v2 mode
  • Remove restriction for engine_version when using serverless v1 (currently forces null but now can be configured by users)
  • Update serverless example to shorten names used and be more consistent with using just v1 and v2 for which serverless mode is used
  • Order cluster arguments to match order of provider schema definition - this makes it easy to see what arguments are supported vs what is not (and needs to be added)
  • Ensure required version specified for examples is consistent with root module
  • Update example tags, name, VPC settings to be consistent with other modules and avoid NAT creation where possible
    • Fix example directories to use hyphens instead of underscores in their names

Motivation and Context

Breaking Changes

  • No

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
    • Validated serverless example
    • Validated multi-az example
    • Validated postgresql example
  • I have executed pre-commit run -a on my pull request

@egeland
Copy link

egeland commented Sep 4, 2022

Would there be a rough estimate on when this (esp the fix for #313 ) would be merged? 🙏 😅

@bryantbiggs bryantbiggs force-pushed the fix/serverless branch 4 times, most recently from 12b28b5 to a1f4b57 Compare September 6, 2022 23:20
@bryantbiggs bryantbiggs marked this pull request as ready for review September 6, 2022 23:46
resource "aws_rds_cluster" "this" {
count = local.create_cluster ? 1 : 0

# Notes:
Copy link
Member Author

Choose a reason for hiding this comment

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

lots of noise due to the re-ordering to match the AWS provider (makes it easier to compare what we support vs what we need to add), apologies for that. However, nothing was deleted - only re-order or the addition of new arguments that we did not previously support (mostly for RDS multi-AZ plus a few others)


engine = var.engine
engine_mode = var.engine_mode
engine_version = local.is_serverless ? null : var.engine_version
Copy link
Member Author

@bryantbiggs bryantbiggs Sep 6, 2022

Choose a reason for hiding this comment

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

this was fixed for the serverless v1 upgrade so users can now set the engine version - not sure when this changed but now its configurable for #313 (i.e. - the conditional check was removed and now its just engine_version = var.engine_version)

}

dynamic "scaling_configuration" {
for_each = length(keys(var.scaling_configuration)) == 0 || !local.is_serverless ? [] : [var.scaling_configuration]
Copy link
Member Author

Choose a reason for hiding this comment

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

a lot of these for_each conditionals were cleaned up and simplified

resource "aws_rds_cluster_endpoint" "this" {
for_each = local.create_cluster && !local.is_serverless ? var.endpoints : tomap({})
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed the looping comprehension

}

resource "aws_rds_cluster_instance" "this" {
for_each = local.create_cluster && !local.is_serverless ? var.instances : {}
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed looping comprehension

resource "aws_rds_cluster_role_association" "this" {
for_each = local.create_cluster ? var.iam_roles : {}
Copy link
Member Author

Choose a reason for hiding this comment

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

fixed looping comprehension


db_cluster_identifier = try(aws_rds_cluster.this[0].id, "")
Copy link
Member Author

Choose a reason for hiding this comment

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

a lot of these wrapped try()s are not doing anything

Copy link
Member

@antonbabenko antonbabenko left a comment

Choose a reason for hiding this comment

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

Just a small comment. LGTM.

examples/multi-az/README.md Outdated Show resolved Hide resolved
examples/multi-az/main.tf Outdated Show resolved Hide resolved
bryantbiggs and others added 2 commits September 7, 2022 07:03
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
@bryantbiggs bryantbiggs merged commit 2d87320 into terraform-aws-modules:master Sep 7, 2022
@bryantbiggs bryantbiggs deleted the fix/serverless branch September 7, 2022 11:21
antonbabenko pushed a commit that referenced this pull request Sep 7, 2022
## [7.4.0](v7.3.0...v7.4.0) (2022-09-07)

### Features

* Fix serverless v2 engine and add missing resource arguments ([#317](#317)) ([2d87320](2d87320))
@antonbabenko
Copy link
Member

This PR is included in version 7.4.0 🎉

@antonbabenko antonbabenko mentioned this pull request Sep 8, 2022
1 task
@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 Apr 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
3 participants