Skip to content

Commit

Permalink
Add support for China partition (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcincuber authored Mar 8, 2021
1 parent 957279a commit fd74df4
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 12 deletions.
4 changes: 2 additions & 2 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: v3.3.0
rev: v3.4.0
hooks:
- id: check-added-large-files
args: ['--maxkb=500']
Expand All @@ -18,7 +18,7 @@ repos:
args: ['--allow-missing-credentials']
- id: trailing-whitespace
- repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.45.0
rev: v1.47.0
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
53 changes: 51 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,49 @@ All notable changes to this project will be documented in this file.
<a name="unreleased"></a>
## [Unreleased]

- Add licecycle to ignore changes for engine_version
- Update README.md


<a name="2.2.0"></a>
## [2.2.0] - 2020-12-02

- Feature/upgrades ([#10](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/10))


<a name="2.1.2"></a>
## [2.1.2] - 2020-11-10

- Fix audit log group creation ([#9](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/9))


<a name="2.1.1"></a>
## [2.1.1] - 2020-11-10

- Fix rds_cluster_instance_endpoints output ([#8](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/8))


<a name="2.1.0"></a>
## [2.1.0] - 2020-11-09

- Add support for global clusters ([#7](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/7))


<a name="2.0.1"></a>
## [2.0.1] - 2020-10-13

- Update main.tf ([#6](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/6))


<a name="2.0.0"></a>
## [2.0.0] - 2020-09-29

- Add support for parameter groups and variables ([#5](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/5))


<a name="1.2.2"></a>
## [1.2.2] - 2020-08-27

- Fix/cluster instance lifecycle ([#4](https://github.com/umotif-public/terraform-aws-rds-aurora/issues/4))


<a name="1.2.1"></a>
Expand Down Expand Up @@ -42,7 +84,14 @@ 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/1.2.1...HEAD
[Unreleased]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.2.0...HEAD
[2.2.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.1.2...2.2.0
[2.1.2]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.1.1...2.1.2
[2.1.1]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.1.0...2.1.1
[2.1.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.0.1...2.1.0
[2.0.1]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/2.0.0...2.0.1
[2.0.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.2.2...2.0.0
[1.2.2]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.2.1...1.2.2
[1.2.1]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.2.0...1.2.1
[1.2.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/umotif-public/terraform-aws-rds-aurora/compare/1.0.1...1.1.0
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ Terraform module which creates AWS RDS Aurora resources. It supports MySQL, Post

## Terraform versions

Terraform 0.12. Pin module version to `~> v2.0`. Submit pull-requests to `master` branch.
Terraform 0.13. Pin module version to `~> v3.0`. Submit pull-requests to `master` branch.

## Usage

```hcl
module "rds-aurora-mysql" {
source = "umotif-public/rds-aurora/aws"
version = "~> 2.0.0"
version = "~> 3.0.0"
name_prefix = "example-aurora-mysql"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.09.0"
engine_version = "5.7.mysql_aurora.2.09.2"
deletion_protection = true
vpc_id = module.vpc.vpc_id
Expand Down Expand Up @@ -92,7 +92,7 @@ In order to activate global cluster, set `enable_global_cluster = true` when usi

| Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| terraform | >= 0.13.0 |
| aws | >= 3.15 |
| random | >= 2.3 |

Expand All @@ -112,6 +112,7 @@ In order to activate global cluster, set `enable_global_cluster = true` when usi
| allowed\_security\_groups | A list of Security Group ID's to allow access to. | `list(string)` | `[]` | no |
| apply\_immediately | Determines whether or not any DB modifications are applied immediately, or during the maintenance window | `bool` | `false` | no |
| auto\_minor\_version\_upgrade | Determines whether minor engine upgrades will be performed automatically in the maintenance window | `bool` | `true` | no |
| aws\_partition | 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 |
| 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 |
| backup\_retention\_period | How long to keep backups for (in days) | `number` | `7` | no |
| ca\_cert\_identifier | The identifier of the CA certificate for the DB instance. | `string` | `"rds-ca-2019"` | no |
Expand All @@ -129,7 +130,7 @@ In order to activate global cluster, set `enable_global_cluster = true` when usi
| deletion\_protection | If the DB instance should have deletion protection enabled | `bool` | `false` | no |
| enable\_global\_cluster | Set this variable to `true` if DB Cluster is going to be part of a Global Cluster. | `bool` | `false` | no |
| enable\_http\_endpoint | Whether or not to enable the Data API for a serverless Aurora database engine. | `bool` | `false` | no |
| enabled\_cloudwatch\_logs\_exports | List of object which define log types to export to AWS Cloudwatch. See in examples. | `list` | `[]` | no |
| enabled\_cloudwatch\_logs\_exports | List of object which define log types to export to AWS Cloudwatch. See in examples. | `list(any)` | `[]` | no |
| engine | Aurora database engine type, currently aurora, aurora-mysql or aurora-postgresql | `string` | `"aurora"` | no |
| engine\_mode | The database engine mode. Valid values: global, parallelquery, provisioned, serverless. | `string` | `"provisioned"` | no |
| engine\_parameter\_family | The database engine paramater group family | `string` | `"aurora-mysql5.7"` | no |
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ resource "aws_iam_role_policy_attachment" "rds_enhanced_monitoring" {
count = var.create_monitoring_role && var.monitoring_interval > 0 ? 1 : 0

role = join("", aws_iam_role.rds_enhanced_monitoring.*.name)
policy_arn = "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
policy_arn = var.aws_partition == "china" ? "arn:aws-cn:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole" : "arn:aws:iam::aws:policy/service-role/AmazonRDSEnhancedMonitoringRole"
}

resource "aws_cloudwatch_log_group" "audit_log_group" {
Expand Down
14 changes: 13 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ variable "iam_database_authentication_enabled" {

variable "enabled_cloudwatch_logs_exports" {
description = "List of object which define log types to export to AWS Cloudwatch. See in examples."
type = list
type = list(any)
default = []
}

Expand Down Expand Up @@ -409,3 +409,15 @@ variable "restore_to_point_in_time" {
type = map(string)
default = {}
}

variable "aws_partition" {
type = string
default = "public"

description = "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."

validation {
condition = contains(["public", "china"], var.aws_partition)
error_message = "Argument \"aws_partition\" must be either \"public\" or \"china\"."
}
}
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
terraform {
required_version = ">= 0.12.6"
required_version = ">= 0.13.0"

required_providers {
aws = ">= 3.15"
Expand Down

0 comments on commit fd74df4

Please sign in to comment.