Commit Graph

8 Commits

Author SHA1 Message Date
The Magician
05d558d33f Add disable_dependent_services to google_project_service resource. (#2938)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-01-28 13:50:41 -08:00
The Magician
c605b0bc4b [Terraform]: Apply gofmt -s to all files managed by MM (#2676)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
Paddy Carver
791c508755 Check for project deletion when refreshing/deleting project_service.
When reading or deleting the google_project_service resource, first
retrieve the project. If it's not found, or if it's pending deletion,
remove the service, as it's functionally disabled.

Also, add a test to confirm the behaviour.

This should resolve #1292.
2018-09-20 12:54:21 -07:00
Seth Vargo
40094ba417 Lions, tigers, and services being enabled with "precondition failed", oh my! (#1565)
* Use errwrap to retain original error

* Use built-in Page function, only return names when listing services

This removes the custom logic on pagination and uses the built-in Page function in the SDK to make things a bit simpler. Additionally, I added a field filter to only return service names, which drastically reduces the size of the API call (important for slow connections, given how frequently this function is executed).

Also added errwrap to better trace where errors originate.

* Add helper function for diffing string slices

This just looked really nasty inline

* Batch 20 services at a time, handle precondition failed, better errwrap

This commit does three things:

1. It batches services to be enabled 20 at a time. The API fails if you try to enable more than 20 services, and this is documented in the SDK and API. I learned this the hard way. I think Terraform should "do the right thing" here and batch them in series' of twenty, which is what this does. Each batch is tried in serial, but I think making it parallelized is not worth the complexity tradeoffs.

2. Handle the precondition failed error that occurs randomly. This just started happened, but it affects at least two APIs consistently, and a rudimentary test showed that it failed 78% of the time (78/100 times in an hour). We should fix this upstream, but that failure rate also necessitates (in my opinion) some mitigation on the Terraform side until a fix is in place at the API level.

3. Use errwrap on errors for better tracing. It was really difficult to trace exactly which error was being throw. That's fixed.

* Updates from code review
2018-05-31 09:26:40 -07:00
Dana Hoffman
20616e424d
Use new serviceusage API for google_project_service[s] (#1522)
* vendor service usage api

* use serviceusage api instead of servicemanagement for project services

* add bigquery-json to test

* add import for project service

* add serviceusage_operation.go
2018-05-22 17:45:22 -07:00
Nathan McKinley
ea50226ade
Add disable_on_destroy option to google_project_service. (#965) 2018-01-16 14:39:27 -08:00
Vincent Roseberry
6c5d6b72e0
Store project and region in state (#784)
* Store project and region in state

* Delete unused project in runtimeconfig_variable
2017-11-27 16:32:20 -08:00
Dana Hoffman
10e4f68441
Add new google_project_service resource for fine-grained service control. (#668)
* add new project service resource; add retry logic for enable/disable

* docs for google_project_service

* add project into the id
2017-11-07 15:19:57 -08:00