Skip to content

Commit 998c826

Browse files
Add check_if_service_has_usage_on_destroy field to google_project_service resource (#10973) (#18753)
[upstream:7dfba49076ed8b42994ca2c24c9cd6511b48d88a] Signed-off-by: Modular Magician <[email protected]>
1 parent 25846ca commit 998c826

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

.changelog/10973.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:enhancement
2+
resourcemanager: added `check_if_service_has_usage_on_destroy` field to `google_project_service` resource
3+
```

google/services/resourcemanager/resource_google_project_service.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,8 @@ func resourceGoogleProjectServiceDelete(d *schema.ResourceData, meta interface{}
258258

259259
service := d.Get("service").(string)
260260
disableDependencies := d.Get("disable_dependent_services").(bool)
261-
if err = disableServiceUsageProjectService(service, project, d, config, disableDependencies); err != nil {
261+
err = disableServiceUsageProjectService(service, project, d, config, disableDependencies)
262+
if err != nil {
262263
return transport_tpg.HandleNotFoundError(err, d, fmt.Sprintf("Project Service %s", d.Id()))
263264
}
264265

website/docs/r/google_project_service.html.markdown

+6
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ and which depend on this service should also be disabled when this service is
5858
destroyed. If `false` or unset, an error will be returned if any enabled
5959
services depend on this service when attempting to destroy it.
6060

61+
* `check_if_service_has_usage_on_destroy` - (Optional)
62+
[Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)
63+
If `true`, the usage of the service to be disabled will be checked and an error
64+
will be returned if the service to be disabled has usage in last 30 days.
65+
Defaults to `false`.
66+
6167
## Attributes Reference
6268

6369
In addition to the arguments listed above, the following computed attributes are

0 commit comments

Comments
 (0)