|
| 1 | +# Upgrading to v8.0 |
| 2 | + |
| 3 | +The v8.0 release of the terraform-google-cloud-storage module is a backwards incompatible release, due to the following breaking change: |
| 4 | + |
| 5 | +- The fix for the issue [Error when using simple bucket with kms created in the same configuration](https://github.com/terraform-google-modules/terraform-google-cloud-storage/issues/339) in the [Simple Bucket](../modules/simple_bucket/README.md) module replaced the creation of an internal KMS key based in the variable `encryption.default_kms_key_name` having a `null` value with an explicit control flag `internal_encryption_config.create_encryption_key`. |
| 6 | + |
| 7 | +## Migration Instructions |
| 8 | + |
| 9 | +To migrate from 5.x or 6.0.0 no change is necessary for the Simple Bucket module. |
| 10 | + |
| 11 | +To migrate from 6.1.0 or 7.x: |
| 12 | + |
| 13 | +- If the feature to auto create KMS keys was not used no change is necessary for the Simple Bucket module |
| 14 | +- If the feature to auto create KMS keys was used, a migration from 7.x to 8.x for the Simple Bucket module as showcased below |
| 15 | + |
| 16 | +```diff |
| 17 | +module "simple_bucket" { |
| 18 | + source = "terraform-google-modules/cloud-storage/google//modules/simple_bucket" |
| 19 | +- version = "~> 7.0" |
| 20 | ++ version = "~> 8.0" |
| 21 | +``` |
| 22 | + |
| 23 | +will produce the following output during a `terraform plan`: |
| 24 | + |
| 25 | +``` |
| 26 | +
|
| 27 | +Error: Missing required argument |
| 28 | +
|
| 29 | + with module.simple_bucket.google_storage_bucket.bucket, |
| 30 | + on .terraform/modules/simple_bucket/main.tf line 22, in resource "google_storage_bucket" "bucket": |
| 31 | + 22: resource "google_storage_bucket" "bucket" { |
| 32 | +
|
| 33 | +The argument "encryption.0.default_kms_key_name" is required, but no definition was found. |
| 34 | +``` |
| 35 | + |
| 36 | +Removing the `null` valued `encryption.default_kms_key_name` |
| 37 | + |
| 38 | +```diff |
| 39 | +- -encryption = { |
| 40 | +- default_kms_key_name = null |
| 41 | +- } |
| 42 | +``` |
| 43 | + |
| 44 | +will produce the following output during a `terraform plan`: |
| 45 | + |
| 46 | +``` |
| 47 | + # module.simple_bucket.google_storage_bucket.bucket will be updated in-place |
| 48 | +
|
| 49 | + # module.simple_bucket.module.encryption_key[0].google_kms_crypto_key.key_ephemeral[0] will be destroyed |
| 50 | + # (because module.simple_bucket.module.encryption_key[0] is not in configuration) |
| 51 | +
|
| 52 | + # module.simple_bucket.module.encryption_key[0].google_kms_crypto_key_iam_binding.decrypters[0] will be destroyed |
| 53 | + # (because module.simple_bucket.module.encryption_key[0] is not in configuration) |
| 54 | +
|
| 55 | + # module.simple_bucket.module.encryption_key[0].google_kms_crypto_key_iam_binding.encrypters[0] will be destroyed |
| 56 | + # (because module.simple_bucket.module.encryption_key[0] is not in configuration) |
| 57 | +
|
| 58 | + # module.simple_bucket.module.encryption_key[0].google_kms_key_ring.key_ring will be destroyed |
| 59 | + # (because module.simple_bucket.module.encryption_key[0] is not in configuration) |
| 60 | +
|
| 61 | +Plan: 0 to add, 1 to change, 4 to destroy. |
| 62 | +``` |
| 63 | + |
| 64 | +To preserve the existing KMS Key, add the following section to your configuration |
| 65 | + |
| 66 | +```diff |
| 67 | ++ internal_encryption_config = { |
| 68 | ++ create_encryption_key = true |
| 69 | ++ } |
| 70 | +``` |
| 71 | + |
| 72 | +Re-running the plan should show that the Simple Bucket resource is no longer showing a diff. |
| 73 | + |
| 74 | +``` |
| 75 | +No changes. Your infrastructure matches the configuration. |
| 76 | +
|
| 77 | +Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed. |
| 78 | +``` |
0 commit comments