Skip to content

Commit 229ae86

Browse files
committed
fix: add triggers to manage Cloud SQL proxy lifecycle
1 parent c740448 commit 229ae86

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,19 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
## [0.5.1] - 2025-11-11
12+
13+
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-mysql-db-and-user-creation-helper/compare/0.5.0...0.5.1)
14+
15+
### Changed
16+
17+
- Ensure the `execute_cloud_sql_proxy` and `kill_cloud_sql_proxy` null resources pick up `permissions_refresh_id` changes so Terraform always restarts/stops the proxy when permissions are reapplied.
18+
- Enforce the start → grant → stop execution order by wiring the proxy/grant null resources through explicit dependencies.
19+
1120
## [0.5.0] - 2025-11-11
1221

22+
[Compare with previous version](https://github.com/sparkfabrik/terraform-google-gcp-mysql-db-and-user-creation-helper/compare/0.4.1...0.5.0)
23+
1324
### Added
1425

1526
- Introduced the `permissions_refresh_id` input plus the `null_resource.force_permissions_refresh`/`null_resource.grant_permissions` helpers so you can rerun the proxy/grant scripts without recreating users.

main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ resource "null_resource" "execute_cloud_sql_proxy" {
22
for_each = (((var.cloudsql_proxy_host == "localhost" || var.cloudsql_proxy_host == "127.0.0.1") && var.terraform_start_cloud_sql_proxy) ? {
33
for u in var.database_and_user_list : u.user => u
44
} : {})
5+
6+
triggers = {
7+
refresh_id = var.permissions_refresh_id
8+
}
9+
510
lifecycle {
611
replace_triggered_by = [
712
null_resource.force_permissions_refresh.id
@@ -117,6 +122,11 @@ resource "null_resource" "kill_cloud_sql_proxy" {
117122
for_each = (((var.cloudsql_proxy_host == "localhost" || var.cloudsql_proxy_host == "127.0.0.1") && var.terraform_start_cloud_sql_proxy) ? {
118123
for u in var.database_and_user_list : u.user => u
119124
} : {})
125+
126+
triggers = {
127+
refresh_id = var.permissions_refresh_id
128+
}
129+
120130
lifecycle {
121131
replace_triggered_by = [
122132
null_resource.force_permissions_refresh.id

0 commit comments

Comments
 (0)