diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go index c0f2b63d8920..1eece93ca437 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object.go @@ -390,6 +390,9 @@ func resourceStorageBucketObjectUpdate(d *schema.ResourceData, meta interface{}) if hasRetentionChanges { if v, ok := d.GetOk("retention"); ok { res.Retention = expandObjectRetention(v) + } else { + res.Retention = nil + res.NullFields = append(res.NullFields, "Retention") } } diff --git a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_test.go b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_test.go index 37386f9a3840..fbad5d66339b 100644 --- a/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_test.go +++ b/mmv1/third_party/terraform/services/storage/resource_storage_bucket_object_test.go @@ -436,13 +436,13 @@ func TestAccStorageObject_retention(t *testing.T) { CheckDestroy: testAccStorageObjectDestroyProducer(t), Steps: []resource.TestStep{ { - Config: testGoogleStorageBucketsObjectRetention(bucketName, "2040-01-01T02:03:04Z"), + Config: testGoogleStorageBucketsObjectRetention(bucketName, "2040-01-01T02:03:04.000Z"), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObject(t, bucketName, objectName, dataMd5), ), }, { - Config: testGoogleStorageBucketsObjectRetention(bucketName, "2040-01-02T02:03:04Z"), + Config: testGoogleStorageBucketsObjectRetention(bucketName, "2040-01-02T02:03:04.000Z"), Check: resource.ComposeTestCheckFunc( testAccCheckGoogleStorageObject(t, bucketName, objectName, dataMd5), ),