Skip to content

Commit f697c2d

Browse files
committed
chore: Update upgrade guide
1 parent d80a81e commit f697c2d

File tree

11 files changed

+75
-65
lines changed

11 files changed

+75
-65
lines changed

UPGRADE-8.0.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,44 @@ If you find a bug, please open an issue with supporting configuration to reprodu
55

66
## List of backwards incompatible changes
77

8+
- With RDS now supporting the [integration with SecretsManager to manage the master user password](https://aws.amazon.com/about-aws/whats-new/2022/12/amazon-rds-integration-aws-secrets-manager/), the ability to generate a random password has been removed from this module. This is the preferred and strongly recommended route to mange the password since it keeps the password out of the Terraform state and allows for the password to be rotated automatically.
9+
- Support for generating a random snapshot identifier has been removed. The AWS provider has been updated to [enforce a conflict between `snapshot_identifier` and `global_cluster_identifier`](https://github.com/hashicorp/terraform-provider-aws/pull/30158) which makes this feature challenging to support; which it has already been challenging to support in the past and often catching users off guard. Instead, the module now defaults to `null` for both of these values and puts the control back in user's hands if they wish to set a value for one of these arguments.
810
- The default value for `create_db_subnet_group` has changed from `true` to `false` - typically, a common/shared DB subnet group is utilized since there are no real tangible benefits to creating a new one for each DB cluster
911
- `allowed_security_groups`, `allowed_cidr_blocks`, and `security_group_egress_rules` have been removed and replaced with a more generic `security_group_rules` variable which supports both ingress and egress rules to/from all supported resources/destinations (e.g. security groups, CIDR blocks, prefix lists, etc.)
10-
- Minimum supported Terraform version is no 1.0
12+
- Minimum supported Terraform version is now 1.0
1113

1214
### Variable and output changes
1315

1416
1. Removed variables:
1517

16-
- `allowed_security_groups` replaced by `security_group_rules`
17-
- `allowed_cidr_blocks` replaced by `security_group_rules`
18-
- `security_group_egress_rules` replaced by `security_group_rules`
18+
- `create_random_password` -> support for random password generation has been removed
19+
- `random_password_length` -> support for random password generation has been removed
20+
- `final_snapshot_identifier_prefix` -> support for random snapshot identifier generation has been removed
21+
- `allowed_security_groups` replaced by `security_group_rules`
22+
- `allowed_cidr_blocks` replaced by `security_group_rules`
23+
- `security_group_egress_rules` replaced by `security_group_rules`
1924

2025
2. Renamed variables:
2126

22-
- None
27+
- `create_cluster` -> `create`
2328

2429
3. Added variables:
2530

26-
- `security_group_rules`
31+
- `manage_master_user_password`
32+
- `master_user_secret_kms_key_id`
33+
- `security_group_rules`
2734

2835
4. Removed outputs:
2936

30-
- None
37+
- None
3138

3239
5. Renamed outputs:
3340

34-
- None
41+
- None
3542

3643
6. Added outputs:
3744

38-
- None
45+
- `cluster_master_user_secret`
3946

4047
## Upgrade Migrations
4148

@@ -47,13 +54,26 @@ module "cluster_before" {
4754
version = "~> 7.0"
4855
4956
# Only the affected attributes are shown
57+
creat_cluster = true
58+
59+
master_username = "admin"
60+
create_random_password = true
61+
random_password_length = 16
5062
5163
create_db_subnet_group = false
5264
db_subnet_group_name = module.vpc.database_subnet_group_name
5365
5466
create_security_group = true
5567
allowed_security_groups = ["sg-12345678"]
5668
allowed_cidr_blocks = ["10.20.0.0/20"]
69+
security_group_egress_rules = {
70+
to_cidrs = {
71+
cidr_blocks = ["10.33.0.0/28"]
72+
description = "Egress to corporate printer closet"
73+
}
74+
}
75+
76+
final_snapshot_identifier_prefix = "my-cluster-"
5777
5878
tags = {
5979
Environment = "dev"
@@ -70,6 +90,9 @@ module "cluster_after" {
7090
version = "~> 8.0"
7191
7292
# Only the affected attributes are shown
93+
create = true
94+
95+
manage_master_user_password = true
7396
7497
db_subnet_group_name = module.vpc.database_subnet_group_name
7598
@@ -80,8 +103,14 @@ module "cluster_after" {
80103
security_group_ingress_ex = {
81104
source_security_group_id = "sg-12345678"
82105
}
106+
to_the_closet = {
107+
cidr_blocks = ["10.33.0.0/28"]
108+
description = "Egress to corporate printer closet"
109+
}
83110
}
84111
112+
final_snapshot_identifier = "my-cluster-with-a-bit-of-something-unique"
113+
85114
tags = {
86115
Environment = "dev"
87116
Terraform = "true"

examples/global-cluster/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,15 @@ Note that this example may create resources which cost money. Run `terraform des
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
2323
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.61 |
24+
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.2 |
2425

2526
## Providers
2627

2728
| Name | Version |
2829
|------|---------|
2930
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.61 |
3031
| <a name="provider_aws.secondary"></a> [aws.secondary](#provider\_aws.secondary) | ~> 4.61 |
32+
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.2 |
3133

3234
## Modules
3335

@@ -45,6 +47,7 @@ Note that this example may create resources which cost money. Run `terraform des
4547
| [aws_kms_key.primary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
4648
| [aws_kms_key.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/kms_key) | resource |
4749
| [aws_rds_global_cluster.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/rds_global_cluster) | resource |
50+
| [random_password.master](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
4851
| [aws_availability_zones.primary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
4952
| [aws_availability_zones.secondary](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
5053
| [aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity) | data source |

examples/global-cluster/main.tf

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
provider "aws" {
2-
region = local.primary.region
2+
region = local.primary_region
33
}
44

55
provider "aws" {
66
alias = "secondary"
7-
region = local.secondary.region
7+
region = local.secondary_region
88
}
99

1010
data "aws_caller_identity" "current" {}
@@ -16,21 +16,14 @@ data "aws_availability_zones" "secondary" {
1616
locals {
1717
name = "ex-${basename(path.cwd)}"
1818

19+
primary_region = "eu-west-1"
1920
primary_vpc_cidr = "10.0.0.0/16"
2021
primary_azs = slice(data.aws_availability_zones.primary.names, 0, 3)
2122

22-
secondary_vpc_cidr = "10.0.1.0/16"
23+
secondary_region = "us-east-1"
24+
secondary_vpc_cidr = "10.1.0.0/16"
2325
secondary_azs = slice(data.aws_availability_zones.secondary.names, 0, 3)
2426

25-
primary = {
26-
region = "eu-west-1"
27-
cidr_prefix = "10.99"
28-
}
29-
secondary = {
30-
region = "us-east-1"
31-
cidr_prefix = "10.98"
32-
}
33-
3427
tags = {
3528
Example = local.name
3629
GithubRepo = "terraform-aws-rds-aurora"
@@ -70,6 +63,9 @@ module "aurora_primary" {
7063
}
7164
}
7265

66+
# Global clusters do not support managed master user password
67+
master_password = random_password.master.result
68+
7369
skip_final_snapshot = true
7470

7571
tags = local.tags
@@ -86,7 +82,7 @@ module "aurora_secondary" {
8682
engine = aws_rds_global_cluster.this.engine
8783
engine_version = aws_rds_global_cluster.this.engine_version
8884
global_cluster_identifier = aws_rds_global_cluster.this.id
89-
source_region = local.primary.region
85+
source_region = local.primary_region
9086
instance_class = "db.r6g.large"
9187
instances = { for i in range(2) : i => {} }
9288
kms_key_id = aws_kms_key.secondary.arn
@@ -99,6 +95,9 @@ module "aurora_secondary" {
9995
}
10096
}
10197

98+
# Global clusters do not support managed master user password
99+
master_password = random_password.master.result
100+
102101
skip_final_snapshot = true
103102

104103
depends_on = [
@@ -112,6 +111,11 @@ module "aurora_secondary" {
112111
# Supporting Resources
113112
################################################################################
114113

114+
resource "random_password" "master" {
115+
length = 20
116+
special = false
117+
}
118+
115119
module "primary_vpc" {
116120
source = "terraform-aws-modules/vpc/aws"
117121
version = "~> 3.0"

examples/global-cluster/versions.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,10 @@ terraform {
66
source = "hashicorp/aws"
77
version = "~> 4.61"
88
}
9+
10+
random = {
11+
source = "hashicorp/random"
12+
version = ">= 2.2"
13+
}
914
}
1015
}

examples/mysql/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ Note that this example may create resources which cost money. Run `terraform des
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
2323
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.61 |
24-
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.2 |
2524

2625
## Providers
2726

2827
| Name | Version |
2928
|------|---------|
3029
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.61 |
31-
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.2 |
3230

3331
## Modules
3432

@@ -41,7 +39,6 @@ Note that this example may create resources which cost money. Run `terraform des
4139

4240
| Name | Type |
4341
|------|------|
44-
| [random_password.master](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
4542
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
4643

4744
## Inputs

examples/mysql/main.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ module "aurora" {
5252
}
5353
}
5454

55-
iam_database_authentication_enabled = true
56-
master_password = random_password.master.result
57-
5855
apply_immediately = true
5956
skip_final_snapshot = true
6057

@@ -151,11 +148,6 @@ module "aurora" {
151148
# Supporting Resources
152149
################################################################################
153150

154-
resource "random_password" "master" {
155-
length = 10
156-
special = false
157-
}
158-
159151
module "vpc" {
160152
source = "terraform-aws-modules/vpc/aws"
161153
version = "~> 3.0"

examples/mysql/versions.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@ terraform {
66
source = "hashicorp/aws"
77
version = "~> 4.61"
88
}
9-
10-
random = {
11-
source = "hashicorp/random"
12-
version = ">= 2.2"
13-
}
149
}
1510
}

examples/postgresql/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,12 @@ Note that this example may create resources which cost money. Run `terraform des
2121
|------|---------|
2222
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
2323
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | ~> 4.61 |
24-
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2.2 |
2524

2625
## Providers
2726

2827
| Name | Version |
2928
|------|---------|
3029
| <a name="provider_aws"></a> [aws](#provider\_aws) | ~> 4.61 |
31-
| <a name="provider_random"></a> [random](#provider\_random) | >= 2.2 |
3230

3331
## Modules
3432

@@ -41,7 +39,6 @@ Note that this example may create resources which cost money. Run `terraform des
4139

4240
| Name | Type |
4341
|------|------|
44-
| [random_password.master](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/password) | resource |
4542
| [aws_availability_zones.available](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/availability_zones) | data source |
4643

4744
## Inputs

examples/postgresql/main.tf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ module "aurora" {
7171
}
7272
}
7373

74-
iam_database_authentication_enabled = true
75-
master_password = random_password.master.result
76-
7774
apply_immediately = true
7875
skip_final_snapshot = true
7976

@@ -115,11 +112,6 @@ module "aurora" {
115112
# Supporting Resources
116113
################################################################################
117114

118-
resource "random_password" "master" {
119-
length = 10
120-
special = false
121-
}
122-
123115
module "vpc" {
124116
source = "terraform-aws-modules/vpc/aws"
125117
version = "~> 3.0"

examples/postgresql/versions.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,5 @@ terraform {
66
source = "hashicorp/aws"
77
version = "~> 4.61"
88
}
9-
10-
random = {
11-
source = "hashicorp/random"
12-
version = ">= 2.2"
13-
}
149
}
1510
}

0 commit comments

Comments
 (0)