Skip to content

Commit e241f40

Browse files
authored
Merge pull request #80 from omazin/upgrading-guide-3.0
Add upgrade guide for 3.0. Update readme.
2 parents add13c3 + 966b520 commit e241f40

File tree

3 files changed

+80
-1
lines changed

3 files changed

+80
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
## [3.0.0] - 2019-12-13
11+
1012
### Removed
1113

1214
- Removed variable `peering_completed`. [#78]
@@ -47,7 +49,8 @@ project adheres to [Semantic Versioning](http://semver.org/).
4749

4850
## [1.0.0] - 2019-02-14
4951

50-
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/v2.0.0...HEAD
52+
[Unreleased]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/v3.0.0...HEAD
53+
[3.0.0]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/v2.0.0...v3.0.0
5154
[2.0.0]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/v1.2.0...v2.0.0
5255
[1.2.0]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/1.1.2...v1.2.0
5356
[1.1.2]: https://github.com/terraform-google-modules/terraform-google-sql-db/compare/1.1.1...1.1.2

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ and need a Terraform 0.11.x-compatible version of this module, the last
1616
released version intended for Terraform 0.11.x is
1717
[v1.2.0](https://registry.terraform.io/modules/GoogleCloudPlatform/sql-db/google/1.2.0).
1818

19+
## Upgrading
20+
21+
The current version is 3.X. The following guides are available to assist with upgrades:
22+
23+
- [1.X -> 2.0](./docs/upgrading_to_sql_db_2.0.0.md)
24+
- [2.X -> 3.0](./docs/upgrading_to_sql_db_3.0.0.md)
25+
1926
## Root module
2027

2128
The root module has been deprecated. Please switch to using one of the submodules.

docs/upgrading_to_sql_db_3.0.0.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Upgrading to SQL DB 3.0.0
2+
3+
The 3.0.0 release of SQL DB is a backward incompatible release. The `peering_completed` string variable along with hardcoded "tf_dependency" label in `user_labels` variable used to ensure that resources are created in a proper order when using private IPs and service network peering were dropped from `postgresql` and `safer_mysql` submodules. Instead the `module_depends_on` variable was added to the `postgresql`, `safer_mysql` and `mysql` submodules, which is a list of modules/resources a submodule depends on.
4+
5+
## Migration Instructions
6+
7+
Prior to the 3.0.0 release, you needed to set the optional `peering_completed` input with a string id of a resource that should have been created before the target sql module (e.g. safer_mysql).
8+
9+
```hcl
10+
// We define a connection with the VPC of the Cloud SQL instance.
11+
module "private-service-access" {
12+
source = "GoogleCloudPlatform/sql-db/google//modules/private_service_access"
13+
project_id = var.project_id
14+
vpc_network = google_compute_network.default.name
15+
}
16+
17+
module "safer-mysql-db" {
18+
source = "GoogleCloudPlatform/sql-db/google//modules/safer_mysql"
19+
version = "2.0.0"
20+
21+
name = "example-safer-mysql-${random_id.name.hex}"
22+
database_version = var.mysql_version
23+
project_id = var.project_id
24+
region = var.region
25+
zone = "c"
26+
27+
...
28+
29+
assign_public_ip = true
30+
vpc_network = google_compute_network.default.self_link
31+
32+
// Used to enforce ordering in the creation of resources.
33+
peering_completed = module.private-service-access.complete
34+
}
35+
36+
```
37+
38+
With the 3.0.0 release, the `module_depends_on` variable is presented which contains a list of modules/resources that should be created before the target sql module.
39+
40+
```diff
41+
// We define a connection with the VPC of the Cloud SQL instance.
42+
module "private-service-access" {
43+
source = "GoogleCloudPlatform/sql-db/google//modules/private_service_access"
44+
project_id = var.project_id
45+
vpc_network = google_compute_network.default.name
46+
}
47+
48+
module "safer-mysql-db" {
49+
source = "GoogleCloudPlatform/sql-db/google//modules/safer_mysql"
50+
- version = "2.0.0"
51+
+ version = "3.0.0"
52+
53+
name = "example-safer-mysql-${random_id.name.hex}"
54+
database_version = var.mysql_version
55+
project_id = var.project_id
56+
region = var.region
57+
zone = "c"
58+
59+
...
60+
61+
assign_public_ip = true
62+
vpc_network = google_compute_network.default.self_link
63+
64+
// Used to enforce ordering in the creation of resources.
65+
- peering_completed = module.private-service-access.complete
66+
+ module_depends_on = [module.private-service-access.complete]
67+
}
68+
69+
```

0 commit comments

Comments
 (0)