@@ -47,15 +47,6 @@ func resourceFirebaseWebApp() *schema.Resource {
4747 Required : true ,
4848 Description : `The user-assigned display name of the App.` ,
4949 },
50- "deletion_policy" : {
51- Type : schema .TypeString ,
52- Optional : true ,
53- ForceNew : true ,
54- Description : `(Optional) Set to 'ABANDON' to allow the WebApp to be untracked from terraform state
55- rather than deleted upon 'terraform destroy'. This is useful becaue the WebApp may be
56- serving traffic. Set to 'DELETE' to delete the WebApp. Default to 'ABANDON'` ,
57- Default : "ABANDON" ,
58- },
5950 "app_id" : {
6051 Type : schema .TypeString ,
6152 Computed : true ,
@@ -76,6 +67,14 @@ This identifier should be treated as an opaque token, as the data format is not
7667 Computed : true ,
7768 Description : `The fully qualified resource name of the App, for example:
7869projects/projectId/webApps/appId` ,
70+ },
71+ "deletion_policy" : {
72+ Type : schema .TypeString ,
73+ Optional : true ,
74+ Default : "ABANDON" ,
75+ Description : `Set to 'ABANDON' to allow the WebApp to be untracked from terraform state
76+ rather than deleted upon 'terraform destroy'. This is useful becaue the WebApp may be
77+ serving traffic. Set to 'DELETE' to delete the WebApp. Default to 'ABANDON'` ,
7978 },
8079 "project" : {
8180 Type : schema .TypeString ,
@@ -193,6 +192,12 @@ func resourceFirebaseWebAppRead(d *schema.ResourceData, meta interface{}) error
193192 return handleNotFoundError (err , d , fmt .Sprintf ("FirebaseWebApp %q" , d .Id ()))
194193 }
195194
195+ // Explicitly set virtual fields to default values if unset
196+ if _ , ok := d .GetOkExists ("deletion_policy" ); ! ok {
197+ if err := d .Set ("deletion_policy" , "ABANDON" ); err != nil {
198+ return fmt .Errorf ("Error setting deletion_policy: %s" , err )
199+ }
200+ }
196201 if err := d .Set ("project" , project ); err != nil {
197202 return fmt .Errorf ("Error reading WebApp: %s" , err )
198203 }
0 commit comments