Skip to content

Commit 48a3b5f

Browse files
authored
Merge pull request #30 from gitpod-io/nv/fix-trust-bundle-rotation
fix: add create_before_destroy to trust bundle GCS object
2 parents d659d7b + 8dd901a commit 48a3b5f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

storage.tf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,9 @@ locals {
264264
has_certificates = var.ca_certificate != null || (var.certificate_secret_id != "" && var.certificate_secret_read)
265265
}
266266

267-
# Upload combined trust bundle certificate to GCS bucket
267+
# Upload combined trust bundle certificate to GCS bucket.
268+
# create_before_destroy ensures the new object is written before the old
269+
# one is removed, preventing a gap if terraform apply is interrupted.
268270
resource "google_storage_bucket_object" "trust_bundle" {
269271
count = local.has_certificates ? 1 : 0
270272

@@ -284,6 +286,10 @@ resource "google_storage_bucket_object" "trust_bundle" {
284286
has_ca_cert = var.ca_certificate != null ? "true" : "false"
285287
has_secret_cert = var.certificate_secret_id != "" && var.certificate_secret_read ? "true" : "false"
286288
}
289+
290+
lifecycle {
291+
create_before_destroy = true
292+
}
287293
}
288294

289295
# Upload Docker config.json to GCS bucket if provided

0 commit comments

Comments
 (0)