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

Add aurora serverlessv2 support #138

Merged
merged 10 commits into from
Jun 13, 2022
Merged

Add aurora serverlessv2 support #138

merged 10 commits into from
Jun 13, 2022

Conversation

topikachu
Copy link
Contributor

what

  • Add aurora serverlessv2 support

why

  • AWS releases aurora serverless v2.
  • Adopt this new feature in this rds cluster module

references

@topikachu topikachu requested review from a team as code owners April 30, 2022 12:05
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
main.tf Show resolved Hide resolved
Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

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

⚠️   Due to 5eaaa83 - Auto Format - 17 errors were fixed.

Change details

Error ID Change Path Resource
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster.aws_rds_cluster_instance.default
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster_instance.default
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster_instance.default

variables.tf Outdated Show resolved Hide resolved
@Gowiem
Copy link
Member

Gowiem commented May 3, 2022

/test all

Co-authored-by: Kevin Mahoney <belay.00.theorem@icloud.com>
main.tf Outdated Show resolved Hide resolved
@@ -218,7 +226,7 @@ resource "aws_rds_cluster_instance" "default" {
count = local.cluster_instance_count
identifier = var.cluster_identifier == "" ? "${module.this.id}-${count.index + 1}" : "${var.cluster_identifier}-${count.index + 1}"
cluster_identifier = coalesce(join("", aws_rds_cluster.primary.*.id), join("", aws_rds_cluster.secondary.*.id))
instance_class = var.instance_type
instance_class = var.serverlessv2_scaling_configuration != null ? "db.serverless" : var.instance_type
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure enhanced monitoring for Amazon RDS instances is enabled
    Resource: module.rds_cluster_aurora_mysql.aws_rds_cluster_instance.default | ID: BC_AWS_LOGGING_28

How to Fix

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  ...
+ monitoring_interval  = 5
  }

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

HIGH   Ensure all data stored in Aurora is securely encrypted at rest
    Resource: module.rds_cluster_aurora_mysql.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_38

How to Fix

resource "aws_rds_cluster" "example" {
  ...
  cluster_identifier      = "aurora-cluster-demo"
+ storage_encrypted       = true
  ...
}

Description

This policy examines the resource **aws_rds_cluster** to check that encryption is set up. The property **storage_encrypted** is examined.

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

MEDIUM   Ensure RDS cluster has IAM authentication enabled
    Resource: module.rds_cluster_aurora_mysql.aws_rds_cluster.primary | ID: BC_AWS_IAM_66

How to Fix

resource "aws_rds_cluster" "enabled" {
	...
+ iam_database_authentication_enabled = true
}

Description

TBD

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure RDS clusters and instances have deletion protection enabled
    Resource: module.rds_cluster_aurora_mysql.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_69

How to Fix

resource "aws_rds_cluster" "default" {
  ...
+ deletion_protection = true
}

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

HIGH   Ensure all data stored in Aurora is securely encrypted at rest
    Resource: module.rds_cluster_aurora_postgres.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_38

How to Fix

resource "aws_rds_cluster" "example" {
  ...
  cluster_identifier      = "aurora-cluster-demo"
+ storage_encrypted       = true
  ...
}

Description

This policy examines the resource **aws_rds_cluster** to check that encryption is set up. The property **storage_encrypted** is examined.

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

MEDIUM   Ensure RDS cluster has IAM authentication enabled
    Resource: module.rds_cluster.aws_rds_cluster.primary | ID: BC_AWS_IAM_66

How to Fix

resource "aws_rds_cluster" "enabled" {
	...
+ iam_database_authentication_enabled = true
}

Description

TBD

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure Amazon RDS clusters and instances have AWS IAM authentication enabled
    Resource: module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary | ID: BC_AWS_IAM_59

How to Fix

resource "aws_rds_cluster" "default" {
  cluster_identifier      = "aurora-cluster-demo"
	...
+  iam_database_authentication_enabled = true
}

Description

TBA. Identity and Access Management (IAM)

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

MEDIUM   Ensure RDS cluster has IAM authentication enabled
    Resource: module.rds_cluster_aurora_postgres.aws_rds_cluster.primary | ID: BC_AWS_IAM_66

How to Fix

resource "aws_rds_cluster" "enabled" {
	...
+ iam_database_authentication_enabled = true
}

Description

TBD

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -218,7 +226,7 @@ resource "aws_rds_cluster_instance" "default" {
count = local.cluster_instance_count
identifier = var.cluster_identifier == "" ? "${module.this.id}-${count.index + 1}" : "${var.cluster_identifier}-${count.index + 1}"
cluster_identifier = coalesce(join("", aws_rds_cluster.primary.*.id), join("", aws_rds_cluster.secondary.*.id))
instance_class = var.instance_type
instance_class = var.serverlessv2_scaling_configuration != null ? "db.serverless" : var.instance_type
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure enhanced monitoring for Amazon RDS instances is enabled
    Resource: module.rds_cluster.aws_rds_cluster_instance.default | ID: BC_AWS_LOGGING_28

How to Fix

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  ...
+ monitoring_interval  = 5
  }

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure Amazon RDS clusters and instances have AWS IAM authentication enabled
    Resource: module.rds_cluster.aws_rds_cluster.primary | ID: BC_AWS_IAM_59

How to Fix

resource "aws_rds_cluster" "default" {
  cluster_identifier      = "aurora-cluster-demo"
	...
+  iam_database_authentication_enabled = true
}

Description

TBA. Identity and Access Management (IAM)

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure RDS clusters and instances have deletion protection enabled
    Resource: module.rds_cluster_aurora_postgres.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_69

How to Fix

resource "aws_rds_cluster" "default" {
  ...
+ deletion_protection = true
}

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

HIGH   Ensure all data stored in Aurora is securely encrypted at rest
    Resource: module.rds_cluster.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_38

How to Fix

resource "aws_rds_cluster" "example" {
  ...
  cluster_identifier      = "aurora-cluster-demo"
+ storage_encrypted       = true
  ...
}

Description

This policy examines the resource **aws_rds_cluster** to check that encryption is set up. The property **storage_encrypted** is examined.

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure RDS clusters and instances have deletion protection enabled
    Resource: module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary | ID: BC_AWS_GENERAL_69

How to Fix

resource "aws_rds_cluster" "default" {
  ...
+ deletion_protection = true
}

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -218,7 +226,7 @@ resource "aws_rds_cluster_instance" "default" {
count = local.cluster_instance_count
identifier = var.cluster_identifier == "" ? "${module.this.id}-${count.index + 1}" : "${var.cluster_identifier}-${count.index + 1}"
cluster_identifier = coalesce(join("", aws_rds_cluster.primary.*.id), join("", aws_rds_cluster.secondary.*.id))
instance_class = var.instance_type
instance_class = var.serverlessv2_scaling_configuration != null ? "db.serverless" : var.instance_type
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure enhanced monitoring for Amazon RDS instances is enabled
    Resource: module.rds_cluster_aurora_postgres.aws_rds_cluster_instance.default | ID: BC_AWS_LOGGING_28

How to Fix

resource "aws_db_instance" "default" {
  allocated_storage    = 10
  ...
+ monitoring_interval  = 5
  }

Description

TBA

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure Amazon RDS clusters and instances have AWS IAM authentication enabled
    Resource: module.rds_cluster_aurora_mysql.aws_rds_cluster.primary | ID: BC_AWS_IAM_59

How to Fix

resource "aws_rds_cluster" "default" {
  cluster_identifier      = "aurora-cluster-demo"
	...
+  iam_database_authentication_enabled = true
}

Description

TBA. Identity and Access Management (IAM)

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

MEDIUM   Ensure RDS cluster has IAM authentication enabled
    Resource: module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary | ID: BC_AWS_IAM_66

How to Fix

resource "aws_rds_cluster" "enabled" {
	...
+ iam_database_authentication_enabled = true
}

Description

TBD

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

@@ -115,6 +115,14 @@ resource "aws_rds_cluster" "primary" {
}
}

dynamic "serverlessv2_scaling_configuration" {
Copy link

Choose a reason for hiding this comment

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

LOW   Ensure Amazon RDS clusters and instances have AWS IAM authentication enabled
    Resource: module.rds_cluster_aurora_postgres.aws_rds_cluster.primary | ID: BC_AWS_IAM_59

How to Fix

resource "aws_rds_cluster" "default" {
  cluster_identifier      = "aurora-cluster-demo"
	...
+  iam_database_authentication_enabled = true
}

Description

TBA. Identity and Access Management (IAM)

🎉   Fixed by commit e9ead5e - upgrade terraform version in test

Copy link

@bridgecrew bridgecrew bot left a comment

Choose a reason for hiding this comment

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

⚠️   Due to e9ead5e - upgrade terraform version in test - 17 errors were fixed.

Change details

Error ID Change Path Resource
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster.aws_rds_cluster_instance.default
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster_instance.default
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_mysql_serverless.aws_rds_cluster.primary
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_GENERAL_69 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster.primary
BC_AWS_LOGGING_28 Fixed /main.tf module.rds_cluster_aurora_postgres.aws_rds_cluster_instance.default
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_IAM_59 Fixed /main.tf module.rds_cluster.aws_rds_cluster.primary
BC_AWS_GENERAL_38 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary
BC_AWS_IAM_66 Fixed /main.tf module.rds_cluster_aurora_mysql.aws_rds_cluster.primary

@Nuru Nuru self-requested a review June 13, 2022 05:12
@Nuru Nuru added no-release Do not create a new release (wait for additional code changes) and removed terraform/1.x labels Jun 13, 2022
@Nuru
Copy link
Sponsor Contributor

Nuru commented Jun 13, 2022

/test all

Copy link
Sponsor Contributor

@Nuru Nuru left a comment

Choose a reason for hiding this comment

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

The bats test failure is due to formatting differences among Terraform versions, and inconsistency in what the actions format with vs what the actions test with. Ignoring it for now.

Marking this version as no-release so we can release it as version 1.0, per Cloud Posse migration to production semantic versioning.

@Nuru Nuru enabled auto-merge (squash) June 13, 2022 05:31
@Nuru Nuru merged commit 2fed1b2 into cloudposse:master Jun 13, 2022
@matharoo matharoo mentioned this pull request Jun 13, 2022
2 tasks
@topikachu
Copy link
Contributor Author

@Nuru I'm happy that this change is merged into the upstream.
I'd like to know if there's any timeline to release this version? So I can use the official cloudposse module in my project.

Thanks

@kevcube
Copy link
Contributor

kevcube commented Jun 15, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-release Do not create a new release (wait for additional code changes)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support serverless v2
7 participants