You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Support deleting Firestore databases (#9450) (#16576)
Due to backwards compatibility concerns, the default behavior remains to
abandon the database upon destroy rather than to actually delete it.
To actually delete the database, you must set deletion_policy to DELETE,
and apply if necessary, before running `terraform destroy`.
This also cleans up some related deletion-related docs and bugs:
* Updates the delete protection docs
* delete_protection_state being enabled with deletion_policy = DELETE fails the destroy
Fixes#16488Fixes#16404Fixes#16325
[upstream:4829cc4a4f604db5d6e1d09a7c85df6250ebc19a]
Signed-off-by: Modular Magician <[email protected]>
Description: `State of delete protection for the database. Possible values: ["DELETE_PROTECTION_STATE_UNSPECIFIED", "DELETE_PROTECTION_ENABLED", "DELETE_PROTECTION_DISABLED"]`,
102
+
Description: `State of delete protection for the database.
103
+
When delete protection is enabled, this database cannot be deleted.
104
+
The default value is 'DELETE_PROTECTION_STATE_UNSPECIFIED', which is currently equivalent to 'DELETE_PROTECTION_DISABLED'.
105
+
**Note:** Additionally, to delete this database using 'terraform destroy', 'deletion_policy' must be set to 'DELETE'. Possible values: ["DELETE_PROTECTION_STATE_UNSPECIFIED", "DELETE_PROTECTION_ENABLED", "DELETE_PROTECTION_DISABLED"]`,
103
106
},
104
107
"point_in_time_recovery_enablement": {
105
108
Type: schema.TypeString,
@@ -156,6 +159,16 @@ This value may be empty in which case the appid to use for URL-encoded keys is t
156
159
Any read or query can specify a readTime within this window, and will read the state of the database at that time.
157
160
If the PITR feature is enabled, the retention period is 7 days. Otherwise, the retention period is 1 hour.
158
161
A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".`,
162
+
},
163
+
"deletion_policy": {
164
+
Type: schema.TypeString,
165
+
Optional: true,
166
+
Default: "ABANDON",
167
+
Description: `Deletion behavior for this database.
168
+
If the deletion policy is 'ABANDON', the database will be removed from Terraform state but not deleted from Google Cloud upon destruction.
169
+
If the deletion policy is 'DELETE', the database will both be removed from Terraform state and deleted from Google Cloud upon destruction.
170
+
The default value is 'ABANDON'.
171
+
See also 'delete_protection'.`,
159
172
},
160
173
"project": {
161
174
Type: schema.TypeString,
@@ -329,6 +342,12 @@ func resourceFirestoreDatabaseRead(d *schema.ResourceData, meta interface{}) err
returnfmt.Errorf("Cannot delete Firestore database %s: Delete Protection is enabled. Set delete_protection_state to DELETE_PROTECTION_DISABLED for this resource and run \"terraform apply\" before attempting to delete it.", d.Get("name").(string))
0 commit comments