Skip to content

Commit f102cc3

Browse files
switch deletion_policy to virtual field for google_firebase_web_app (#6738) (#4822)
Signed-off-by: Modular Magician <[email protected]> Signed-off-by: Modular Magician <[email protected]>
1 parent f61f75a commit f102cc3

17 files changed

+100
-36
lines changed

.changelog/6738.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:none
2+
3+
```

google-beta/resource_app_engine_flexible_app_version.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -842,14 +842,16 @@ Reserved names,"default", "latest", and any name with the prefix "ah-".`,
842842
Description: `Full path to the Version resource in the API. Example, "v1".`,
843843
},
844844
"noop_on_destroy": {
845-
Type: schema.TypeBool,
846-
Optional: true,
847-
Default: false,
845+
Type: schema.TypeBool,
846+
Optional: true,
847+
Default: false,
848+
Description: `If set to 'true', the application version will not be deleted.`,
848849
},
849850
"delete_service_on_destroy": {
850-
Type: schema.TypeBool,
851-
Optional: true,
852-
Default: false,
851+
Type: schema.TypeBool,
852+
Optional: true,
853+
Default: false,
854+
Description: `If set to 'true', the service will be deleted if it is the last version.`,
853855
},
854856
"project": {
855857
Type: schema.TypeString,

google-beta/resource_app_engine_standard_app_version.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -442,14 +442,16 @@ Substitute '<language>' with 'python', 'java', 'php', 'ruby', 'go' or 'nodejs'.`
442442
Description: `Full path to the Version resource in the API. Example, "v1".`,
443443
},
444444
"noop_on_destroy": {
445-
Type: schema.TypeBool,
446-
Optional: true,
447-
Default: false,
445+
Type: schema.TypeBool,
446+
Optional: true,
447+
Default: false,
448+
Description: `If set to 'true', the application version will not be deleted.`,
448449
},
449450
"delete_service_on_destroy": {
450-
Type: schema.TypeBool,
451-
Optional: true,
452-
Default: false,
451+
Type: schema.TypeBool,
452+
Optional: true,
453+
Default: false,
454+
Description: `If set to 'true', the service will be deleted if it is the last version.`,
453455
},
454456
"project": {
455457
Type: schema.TypeString,

google-beta/resource_bigquery_dataset.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ milliseconds since the epoch.`,
205205
Type: schema.TypeBool,
206206
Optional: true,
207207
Default: false,
208+
Description: `If set to 'true', delete all the tables in the
209+
dataset when destroying the resource; otherwise,
210+
destroying the resource will fail if tables are present.`,
208211
},
209212
"project": {
210213
Type: schema.TypeString,

google-beta/resource_cloud_run_service.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,11 @@ https://{route-hash}-{project-hash}-{cluster-level-suffix}.a.run.app`,
960960
Type: schema.TypeBool,
961961
Optional: true,
962962
Default: false,
963+
Description: `If set to 'true', the revision name (template.metadata.name) will be omitted and
964+
autogenerated by Cloud Run. This cannot be set to 'true' while 'template.metadata.name'
965+
is also set.
966+
(For legacy support, if 'template.metadata.name' is unset in state while
967+
this field is set to false, the revision name will still autogenerate.)`,
963968
},
964969
"project": {
965970
Type: schema.TypeString,

google-beta/resource_compute_network.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,8 @@ is selected by GCP.`,
122122
Type: schema.TypeBool,
123123
Optional: true,
124124
Default: false,
125+
Description: `If set to 'true', default routes ('0.0.0.0/0') will be deleted
126+
immediately after network creation. Defaults to 'false'.`,
125127
},
126128
"project": {
127129
Type: schema.TypeString,

google-beta/resource_compute_per_instance_config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,31 @@ func resourceComputePerInstanceConfig() *schema.Resource {
8888
Type: schema.TypeString,
8989
Optional: true,
9090
Default: "NONE",
91+
Description: `The minimal action to perform on the instance during an update.
92+
Default is 'NONE'. Possible values are:
93+
* REPLACE
94+
* RESTART
95+
* REFRESH
96+
* NONE`,
9197
},
9298
"most_disruptive_allowed_action": {
9399
Type: schema.TypeString,
94100
Optional: true,
95101
Default: "REPLACE",
102+
Description: `The most disruptive action to perform on the instance during an update.
103+
Default is 'REPLACE'. Possible values are:
104+
* REPLACE
105+
* RESTART
106+
* REFRESH
107+
* NONE`,
96108
},
97109
"remove_instance_state_on_destroy": {
98110
Type: schema.TypeBool,
99111
Optional: true,
100112
Default: false,
113+
Description: `When true, deleting this config will immediately remove any specified state from the underlying instance.
114+
When false, deleting this config will *not* immediately remove any state from the underlying instance.
115+
State will be removed on the next instance recreation or update.`,
101116
},
102117
"project": {
103118
Type: schema.TypeString,

google-beta/resource_compute_region_per_instance_config.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,31 @@ func resourceComputeRegionPerInstanceConfig() *schema.Resource {
8989
Type: schema.TypeString,
9090
Optional: true,
9191
Default: "NONE",
92+
Description: `The minimal action to perform on the instance during an update.
93+
Default is 'NONE'. Possible values are:
94+
* REPLACE
95+
* RESTART
96+
* REFRESH
97+
* NONE`,
9298
},
9399
"most_disruptive_allowed_action": {
94100
Type: schema.TypeString,
95101
Optional: true,
96102
Default: "REPLACE",
103+
Description: `The most disruptive action to perform on the instance during an update.
104+
Default is 'REPLACE'. Possible values are:
105+
* REPLACE
106+
* RESTART
107+
* REFRESH
108+
* NONE`,
97109
},
98110
"remove_instance_state_on_destroy": {
99111
Type: schema.TypeBool,
100112
Optional: true,
101113
Default: false,
114+
Description: `When true, deleting this config will immediately remove any specified state from the underlying instance.
115+
When false, deleting this config will *not* immediately remove any state from the underlying instance.
116+
State will be removed on the next instance recreation or update.`,
102117
},
103118
"project": {
104119
Type: schema.TypeString,

google-beta/resource_dns_managed_zone.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,10 @@ defined by the server`,
320320
},
321321
},
322322
"force_destroy": {
323-
Type: schema.TypeBool,
324-
Optional: true,
325-
Default: false,
323+
Type: schema.TypeBool,
324+
Optional: true,
325+
Default: false,
326+
Description: `Set this true to delete all records in the zone.`,
326327
},
327328
"project": {
328329
Type: schema.TypeString,

google-beta/resource_firebase_web_app.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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:
7869
projects/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

Comments
 (0)