Skip to content

Commit

Permalink
Upgrade to 5.x compatibility + update examples/variables (#17)
Browse files Browse the repository at this point in the history
* Upgrade to 5.x compatibility + update examples/variables

* lint fixes + add versions to examples
  • Loading branch information
Ohid25 authored Jul 27, 2023
1 parent 41e5b25 commit 5c07978
Show file tree
Hide file tree
Showing 18 changed files with 269 additions and 103 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=500']
Expand All @@ -17,8 +17,8 @@ repos:
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- id: trailing-whitespace
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.50.0
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.81.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
<a name="unreleased"></a>
## [Unreleased]

- Upgrade to 5.x compatibility + update examples/variables


<a name="3.2.1"></a>
## [3.2.1] - 2021-07-07

- Add more cluster instance outputs ([#15](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/15))


<a name="3.2.0"></a>
## [3.2.0] - 2021-06-23

- Add s3_import option ([#14](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/14))


<a name="3.1.0"></a>
Expand Down Expand Up @@ -96,7 +109,9 @@ All notable changes to this project will be documented in this file.
- Initial commit


[Unreleased]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/3.1.0...HEAD
[Unreleased]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/3.2.1...HEAD
[3.2.1]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/3.1.0...3.2.0
[3.1.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/3.0.0...3.1.0
[3.0.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.2.0...3.0.0
[2.2.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.1.2...2.2.0
Expand Down
23 changes: 11 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ module "rds-aurora-mysql" {
name_prefix = "example-aurora-mysql"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.10.0"
engine_version = "8.0.mysql_aurora.3.03.1"
deletion_protection = true
vpc_id = module.vpc.vpc_id
subnets = module.vpc.public_subnets
replica_count = 2
instance_type = "db.t3.medium"
instance_type = "db.t4g.medium"
apply_immediately = true
skip_final_snapshot = true
Expand Down Expand Up @@ -71,7 +71,7 @@ module "rds-aurora-mysql" {

## Authors

Module managed by [Marcin Cuber](https://github.com/marcincuber) [LinkedIn](https://www.linkedin.com/in/marcincuber/).
Module managed by [uMotif](https://github.com/umotif-public/).

## Global Aurora Cluster

Expand All @@ -88,16 +88,16 @@ In order to activate global cluster, set `enable_global_cluster = true` when usi

| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.0 |
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0.11 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.15 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.3 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.1.1 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.15 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.3 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 3.1.1 |

## Modules

Expand Down Expand Up @@ -135,7 +135,6 @@ No modules.
| <a name="input_allowed_security_groups"></a> [allowed\_security\_groups](#input\_allowed\_security\_groups) | A list of Security Group ID's to allow access to. | `list(string)` | `[]` | no |
| <a name="input_apply_immediately"></a> [apply\_immediately](#input\_apply\_immediately) | Determines whether or not any DB modifications are applied immediately, or during the maintenance window | `bool` | `false` | no |
| <a name="input_auto_minor_version_upgrade"></a> [auto\_minor\_version\_upgrade](#input\_auto\_minor\_version\_upgrade) | Determines whether minor engine upgrades will be performed automatically in the maintenance window | `bool` | `true` | no |
| <a name="input_aws_partition"></a> [aws\_partition](#input\_aws\_partition) | [Deprecated] A Partition is a group of AWS Region and Service objects. You can use a partition to determine what services are available in a region, or what regions a service is available in. | `string` | `"public"` | no |
| <a name="input_backtrack_window"></a> [backtrack\_window](#input\_backtrack\_window) | The target backtrack window, in seconds. Only available for aurora engine currently. To disable backtracking, set this value to 0. Defaults to 0. Must be between 0 and 259200 (72 hours) | `number` | `0` | no |
| <a name="input_backup_retention_period"></a> [backup\_retention\_period](#input\_backup\_retention\_period) | How long to keep backups for (in days) | `number` | `7` | no |
| <a name="input_ca_cert_identifier"></a> [ca\_cert\_identifier](#input\_ca\_cert\_identifier) | The identifier of the CA certificate for the DB instance. | `string` | `"rds-ca-2019"` | no |
Expand All @@ -156,14 +155,14 @@ No modules.
| <a name="input_enabled_cloudwatch_logs_exports"></a> [enabled\_cloudwatch\_logs\_exports](#input\_enabled\_cloudwatch\_logs\_exports) | List of object which define log types to export to AWS Cloudwatch. See in examples. | `list(any)` | `[]` | no |
| <a name="input_engine"></a> [engine](#input\_engine) | Aurora database engine type, currently aurora, aurora-mysql or aurora-postgresql | `string` | `"aurora"` | no |
| <a name="input_engine_mode"></a> [engine\_mode](#input\_engine\_mode) | The database engine mode. Valid values: global, parallelquery, provisioned, serverless. | `string` | `"provisioned"` | no |
| <a name="input_engine_parameter_family"></a> [engine\_parameter\_family](#input\_engine\_parameter\_family) | The database engine paramater group family | `string` | `"aurora-mysql5.7"` | no |
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Aurora database engine version. | `string` | `"5.7.mysql_aurora.2.09.0"` | no |
| <a name="input_engine_parameter_family"></a> [engine\_parameter\_family](#input\_engine\_parameter\_family) | The database engine paramater group family | `string` | `"aurora-mysql8.0"` | no |
| <a name="input_engine_version"></a> [engine\_version](#input\_engine\_version) | Aurora database engine version. | `string` | `"8.0.mysql_aurora.3.03.1"` | no |
| <a name="input_final_snapshot_identifier_prefix"></a> [final\_snapshot\_identifier\_prefix](#input\_final\_snapshot\_identifier\_prefix) | The prefix name to use when creating a final snapshot on cluster destroy, appends a random 8 digits to name to ensure it's unique too. | `string` | `"final"` | no |
| <a name="input_global_cluster_identifier"></a> [global\_cluster\_identifier](#input\_global\_cluster\_identifier) | The global cluster identifier specified on aws\_rds\_global\_cluster | `string` | `""` | no |
| <a name="input_iam_database_authentication_enabled"></a> [iam\_database\_authentication\_enabled](#input\_iam\_database\_authentication\_enabled) | Specifies whether IAM Database authentication should be enabled or not. Not all versions and instances are supported. Refer to the AWS documentation to see which versions are supported. | `bool` | `true` | no |
| <a name="input_iam_roles"></a> [iam\_roles](#input\_iam\_roles) | A List of ARNs for the IAM roles to associate to the RDS Cluster. | `list(string)` | `[]` | no |
| <a name="input_instance_type"></a> [instance\_type](#input\_instance\_type) | Instance type to use | `string` | n/a | yes |
| <a name="input_instances_parameters"></a> [instances\_parameters](#input\_instances\_parameters) | Individual settings for instances. | `list` | `[]` | no |
| <a name="input_instances_parameters"></a> [instances\_parameters](#input\_instances\_parameters) | Individual settings for instances. | `list(string)` | `[]` | no |
| <a name="input_kms_key_id"></a> [kms\_key\_id](#input\_kms\_key\_id) | The ARN for the KMS encryption key if one is set to the cluster. | `string` | `null` | no |
| <a name="input_monitoring_interval"></a> [monitoring\_interval](#input\_monitoring\_interval) | The interval (seconds) between points when Enhanced Monitoring metrics are collected. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. | `number` | `0` | no |
| <a name="input_monitoring_role_arn"></a> [monitoring\_role\_arn](#input\_monitoring\_role\_arn) | IAM role for RDS to send enhanced monitoring metrics to CloudWatch | `string` | `null` | no |
Expand All @@ -187,14 +186,14 @@ No modules.
| <a name="input_replica_scale_max"></a> [replica\_scale\_max](#input\_replica\_scale\_max) | Maximum number of replicas to allow scaling for | `number` | `0` | no |
| <a name="input_replica_scale_min"></a> [replica\_scale\_min](#input\_replica\_scale\_min) | Minimum number of replicas to allow scaling for | `number` | `2` | no |
| <a name="input_replica_scale_out_cooldown"></a> [replica\_scale\_out\_cooldown](#input\_replica\_scale\_out\_cooldown) | Cooldown in seconds before allowing further scaling operations after a scale out | `number` | `300` | no |
| <a name="input_replication_source_identifier"></a> [replication\_source\_identifier](#input\_replication\_source\_identifier) | ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica. | `any` | `null` | no |
| <a name="input_replication_source_identifier"></a> [replication\_source\_identifier](#input\_replication\_source\_identifier) | ARN of a source DB cluster or DB instance if this DB cluster is to be created as a Read Replica. | `string` | `null` | no |
| <a name="input_restore_to_point_in_time"></a> [restore\_to\_point\_in\_time](#input\_restore\_to\_point\_in\_time) | Restore to point in time configuration. See docs for arguments https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_cluster#restore_to_point_in_time-argument-reference | `map(string)` | `{}` | no |
| <a name="input_s3_import"></a> [s3\_import](#input\_s3\_import) | Restore from a Percona XtraBackup stored in S3 bucket. Only Aurora MySQL is supported. | `map(string)` | `null` | no |
| <a name="input_scaling_configuration"></a> [scaling\_configuration](#input\_scaling\_configuration) | Map of nested attributes with scaling properties. Only valid when engine\_mode is set to `serverless` | `map(string)` | `{}` | no |
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The description of the security group. If value is set to empty string it will contain cluster name in the description. | `string` | `""` | no |
| <a name="input_skip_final_snapshot"></a> [skip\_final\_snapshot](#input\_skip\_final\_snapshot) | Should a final snapshot be created on cluster destroy | `bool` | `false` | no |
| <a name="input_snapshot_identifier"></a> [snapshot\_identifier](#input\_snapshot\_identifier) | DB snapshot to create this database from | `string` | `null` | no |
| <a name="input_source_region"></a> [source\_region](#input\_source\_region) | The source region for an encrypted replica DB cluster. | `any` | `null` | no |
| <a name="input_source_region"></a> [source\_region](#input\_source\_region) | The source region for an encrypted replica DB cluster. | `string` | `null` | no |
| <a name="input_storage_encrypted"></a> [storage\_encrypted](#input\_storage\_encrypted) | Specifies whether the underlying storage layer should be encrypted | `bool` | `true` | no |
| <a name="input_subnets"></a> [subnets](#input\_subnets) | List of subnet IDs to use | `list(string)` | `[]` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
Expand Down
45 changes: 45 additions & 0 deletions examples/aurora-mysql/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions examples/aurora-mysql/kms.tf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ data "aws_iam_policy_document" "cloudwatch" {
#############
module "kms" {
source = "umotif-public/kms/aws"
version = "~> 1.0"
version = "~> 2.0"

alias_name = "rds-kms-test-key"
deletion_window_in_days = 7
Expand All @@ -96,7 +96,7 @@ module "kms" {

module "kms-cloudwatch" {
source = "umotif-public/kms/aws"
version = "~> 1.0"
version = "~> 2.0"

alias_name = "cloudwatch-kms-test-key"
deletion_window_in_days = 7
Expand Down
19 changes: 7 additions & 12 deletions examples/aurora-mysql/main.tf
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
provider "aws" {
region = "eu-west-1"
}

data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

#####
# VPC and subnets
#####
data "aws_vpc" "default" {
default = true
}

data "aws_subnet_ids" "all" {
vpc_id = data.aws_vpc.default.id
data "aws_subnets" "all" {
filter {
name = "vpc-id"
values = [data.aws_vpc.default.id]
}
}

#############
Expand All @@ -25,16 +21,15 @@ module "aurora" {
name_prefix = "example-aurora-mysql"
database_name = "databaseName"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.09.0"
deletion_protection = false

vpc_id = data.aws_vpc.default.id
subnets = data.aws_subnet_ids.all.ids
subnets = data.aws_subnets.all.ids

kms_key_id = module.kms.key_arn

replica_count = 1
instance_type = "db.t3.medium"
instance_type = "db.t4g.medium"
apply_immediately = true
allow_major_version_upgrade = true
skip_final_snapshot = true
Expand Down
20 changes: 20 additions & 0 deletions examples/aurora-mysql/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
provider "aws" {
region = "eu-west-1"
}

terraform {
required_version = ">= 1.0.11"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5"
}

random = {
source = "hashicorp/random"
version = "~> 3"
}
}
}

41 changes: 41 additions & 0 deletions examples/aurora-postgres/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 9 additions & 10 deletions examples/aurora-postgres/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
provider "aws" {
region = "eu-west-1"
}

#####
# VPC and subnets
#####
data "aws_vpc" "default" {
default = true
}

data "aws_subnet_ids" "all" {
vpc_id = data.aws_vpc.default.id
data "aws_subnets" "all" {
filter {
name = "vpc-id"
values = [data.aws_vpc.default.id]
}
}

#############
Expand All @@ -22,8 +21,8 @@ module "aurora-postgresql" {
name_prefix = "example-aurora-postgresql"

engine = "aurora-postgresql"
engine_version = "11.8"
engine_parameter_family = "aurora-postgresql11"
engine_version = "15.3"
engine_parameter_family = "aurora-postgresql15"

apply_immediately = true
allow_major_version_upgrade = true
Expand All @@ -38,10 +37,10 @@ module "aurora-postgresql" {
]

vpc_id = data.aws_vpc.default.id
subnets = data.aws_subnet_ids.all.ids
subnets = data.aws_subnets.all.ids

replica_count = 1
instance_type = "db.t3.medium"
instance_type = "db.t4g.medium"

allowed_cidr_blocks = ["10.10.0.0/24", "10.20.0.0/24", "10.30.0.0/24"]

Expand Down
20 changes: 20 additions & 0 deletions examples/aurora-postgres/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
provider "aws" {
region = "eu-west-1"
}

terraform {
required_version = ">= 1.0.11"

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5"
}

random = {
source = "hashicorp/random"
version = "~> 3"
}
}
}

17 changes: 0 additions & 17 deletions examples/global-aurora-mysql/main.tf
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
provider "aws" {
region = "eu-west-1"
version = ">= 3.14"
}

provider "aws" {
alias = "primary"
region = "eu-west-1"
version = ">= 3.14"
}

provider "aws" {
alias = "secondary"
region = "eu-west-2"
version = ">= 3.14"
}

data "aws_caller_identity" "current" {}
data "aws_region" "current" {}

variable "engine_version" {
type = string
Expand Down
Loading

0 comments on commit 5c07978

Please sign in to comment.