Skip to content

Commit

Permalink
feat: Multi-az rds cluster ca cert identifier (#458)
Browse files Browse the repository at this point in the history
* multi-az rds cluster ca cert identifier

* update variable description

* remove param for testing
  • Loading branch information
magreenbaum authored Jul 12, 2024
1 parent e9eb2b6 commit d320348
Show file tree
Hide file tree
Showing 21 changed files with 60 additions and 26 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,13 @@ Terraform documentation is generated automatically using [pre-commit hooks](http
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand Down Expand Up @@ -283,6 +283,7 @@ No modules.
| <a name="input_cloudwatch_log_group_kms_key_id"></a> [cloudwatch\_log\_group\_kms\_key\_id](#input\_cloudwatch\_log\_group\_kms\_key\_id) | The ARN of the KMS Key to use when encrypting log data | `string` | `null` | no |
| <a name="input_cloudwatch_log_group_retention_in_days"></a> [cloudwatch\_log\_group\_retention\_in\_days](#input\_cloudwatch\_log\_group\_retention\_in\_days) | The number of days to retain CloudWatch logs for the DB instance | `number` | `7` | no |
| <a name="input_cloudwatch_log_group_skip_destroy"></a> [cloudwatch\_log\_group\_skip\_destroy](#input\_cloudwatch\_log\_group\_skip\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state | `bool` | `null` | no |
| <a name="input_cluster_ca_cert_identifier"></a> [cluster\_ca\_cert\_identifier](#input\_cluster\_ca\_cert\_identifier) | The CA certificate identifier to use for the DB cluster's server certificate. Currently only supported for multi-az DB clusters | `string` | `null` | no |
| <a name="input_cluster_members"></a> [cluster\_members](#input\_cluster\_members) | List of RDS Instances that are a part of this cluster | `list(string)` | `null` | no |
| <a name="input_cluster_tags"></a> [cluster\_tags](#input\_cluster\_tags) | A map of tags to add to only the cluster. Used for AWS Instance Scheduler tagging | `map(string)` | `{}` | no |
| <a name="input_cluster_timeouts"></a> [cluster\_timeouts](#input\_cluster\_timeouts) | Create, update, and delete timeout configurations for the cluster | `map(string)` | `{}` | no |
Expand Down Expand Up @@ -392,6 +393,8 @@ No modules.
|------|-------------|
| <a name="output_additional_cluster_endpoints"></a> [additional\_cluster\_endpoints](#output\_additional\_cluster\_endpoints) | A map of additional cluster endpoints and their attributes |
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | Amazon Resource Name (ARN) of cluster |
| <a name="output_cluster_ca_certificate_identifier"></a> [cluster\_ca\_certificate\_identifier](#output\_cluster\_ca\_certificate\_identifier) | CA identifier of the CA certificate used for the DB instance's server certificate |
| <a name="output_cluster_ca_certificate_valid_till"></a> [cluster\_ca\_certificate\_valid\_till](#output\_cluster\_ca\_certificate\_valid\_till) | Expiration date of the DB instance’s server certificate |
| <a name="output_cluster_database_name"></a> [cluster\_database\_name](#output\_cluster\_database\_name) | Name for an automatically created database on cluster creation |
| <a name="output_cluster_endpoint"></a> [cluster\_endpoint](#output\_cluster\_endpoint) | Writer endpoint for the cluster |
| <a name="output_cluster_engine_version_actual"></a> [cluster\_engine\_version\_actual](#output\_cluster\_engine\_version\_actual) | The running version of the cluster database |
Expand Down
4 changes: 2 additions & 2 deletions examples/autoscaling/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/autoscaling/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}
6 changes: 3 additions & 3 deletions examples/global-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.2 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws.secondary"></a> [aws.secondary](#provider\_aws.secondary) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |
| <a name="provider_aws.secondary"></a> [aws.secondary](#provider\_aws.secondary) | >= 5.58 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.2 |

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/global-cluster/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}

random = {
Expand Down
6 changes: 4 additions & 2 deletions examples/multi-az/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand All @@ -51,6 +51,8 @@ No inputs.
|------|-------------|
| <a name="output_additional_cluster_endpoints"></a> [additional\_cluster\_endpoints](#output\_additional\_cluster\_endpoints) | A map of additional cluster endpoints and their attributes |
| <a name="output_cluster_arn"></a> [cluster\_arn](#output\_cluster\_arn) | Amazon Resource Name (ARN) of cluster |
| <a name="output_cluster_ca_certificate_identifier"></a> [cluster\_ca\_certificate\_identifier](#output\_cluster\_ca\_certificate\_identifier) | CA identifier of the CA certificate used for the DB instance's server certificate |
| <a name="output_cluster_ca_certificate_valid_till"></a> [cluster\_ca\_certificate\_valid\_till](#output\_cluster\_ca\_certificate\_valid\_till) | Expiration date of the DB instance’s server certificate |
| <a name="output_cluster_database_name"></a> [cluster\_database\_name](#output\_cluster\_database\_name) | Name for an automatically created database on cluster creation |
| <a name="output_cluster_endpoint"></a> [cluster\_endpoint](#output\_cluster\_endpoint) | Writer endpoint for the cluster |
| <a name="output_cluster_engine_version_actual"></a> [cluster\_engine\_version\_actual](#output\_cluster\_engine\_version\_actual) | The running version of the cluster database |
Expand Down
4 changes: 3 additions & 1 deletion examples/multi-az/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module "aurora" {

name = local.name
engine = "postgres" # This uses RDS engine, not Aurora
engine_version = "14.5"
engine_version = "15.7"
master_username = "root"

vpc_id = module.vpc.vpc_id
Expand All @@ -45,6 +45,8 @@ module "aurora" {
iops = 2500
storage_type = "io1"

cluster_ca_cert_identifier = "rds-ca-rsa4096-g1"

skip_final_snapshot = true

tags = local.tags
Expand Down
10 changes: 10 additions & 0 deletions examples/multi-az/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ output "cluster_hosted_zone_id" {
value = module.aurora.cluster_hosted_zone_id
}

output "cluster_ca_certificate_identifier" {
description = "CA identifier of the CA certificate used for the DB instance's server certificate"
value = module.aurora.cluster_ca_certificate_identifier
}

output "cluster_ca_certificate_valid_till" {
description = "Expiration date of the DB instance’s server certificate"
value = module.aurora.cluster_ca_certificate_valid_till
}

################################################################################
# Cluster Instance(s)
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion examples/multi-az/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}
4 changes: 2 additions & 2 deletions examples/mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/mysql/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}
4 changes: 2 additions & 2 deletions examples/postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/postgresql/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}
4 changes: 2 additions & 2 deletions examples/s3-import/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.42 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.58 |

## Modules

Expand Down
2 changes: 1 addition & 1 deletion examples/s3-import/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}
4 changes: 2 additions & 2 deletions examples/serverless/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.42 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.58 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 3.5 |

## Providers

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

## Modules
Expand Down
2 changes: 1 addition & 1 deletion examples/serverless/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
random = {
source = "hashicorp/random"
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "aws_rds_cluster" "this" {
availability_zones = var.availability_zones
backup_retention_period = var.backup_retention_period
backtrack_window = local.backtrack_window
ca_certificate_identifier = var.cluster_ca_cert_identifier
cluster_identifier = var.cluster_use_name_prefix ? null : var.name
cluster_identifier_prefix = var.cluster_use_name_prefix ? "${var.name}-" : null
cluster_members = var.cluster_members
Expand Down
10 changes: 10 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@ output "cluster_hosted_zone_id" {
value = try(aws_rds_cluster.this[0].hosted_zone_id, null)
}

output "cluster_ca_certificate_identifier" {
description = "CA identifier of the CA certificate used for the DB instance's server certificate"
value = try(aws_rds_cluster.this[0].ca_certificate_identifier, null)
}

output "cluster_ca_certificate_valid_till" {
description = "Expiration date of the DB instance’s server certificate"
value = try(aws_rds_cluster.this[0].ca_certificate_valid_till, null)
}

################################################################################
# Cluster Instance(s)
################################################################################
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ variable "backtrack_window" {
default = null
}

variable "cluster_ca_cert_identifier" {
description = "The CA certificate identifier to use for the DB cluster's server certificate. Currently only supported for multi-az DB clusters"
type = string
default = null
}

variable "cluster_members" {
description = "List of RDS Instances that are a part of this cluster"
type = list(string)
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 5.42"
version = ">= 5.58"
}
}
}

0 comments on commit d320348

Please sign in to comment.