Commit Graph

759 Commits

Author SHA1 Message Date
Paddy
8296c16168 Remove extraneous Exists checks in App Engine tests. 2018-06-07 18:16:48 -07:00
Paddy
4176a98949 terraform fmt all configs in project_test. 2018-06-07 18:14:43 -07:00
Paddy
6910d8277e SetPartial on app_engine. 2018-06-07 18:11:07 -07:00
Paddy
4999637399 Remove unnecessary CustomizeDiff function. 2018-06-07 18:09:51 -07:00
Paddy
16ab5bb14b Reorder fields. 2018-06-07 18:09:14 -07:00
Paddy Carver
6d040db9d8 Really fix location_id force new. 2018-06-07 15:37:30 -07:00
Paddy Carver
9ebeeda1d2 Fix forcenew for location_id. 2018-06-05 15:31:52 -07:00
Paddy Carver
d0a6b2b5b5 Make App Engine applications updatable.
No longer ForceNew when adding an App Engine application to a project,
when modifying the auth domain, modifying the serving status, or
modifying the feature settings.
2018-05-31 14:26:24 -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
The Magician
6240cf2ab4 Add support for SSL policy to google_compute_target_ssl_proxy (#1568) 2018-05-30 16:00:53 -07:00
Tenorio Orta JM
8a77e42698 Added support for restoring default organization policies (#1477)
* Added support for restoring default organization policies

* Added support for restoring default folder/project organization policies

* Refactored code

* Fixes #1239

* Clarify docs

* Clarify docs

* Clarify docs
2018-05-30 15:48:08 -07:00
Tenorio Orta JM
c6b0cfcbfa Added user label support in sql_database_instance (#1372) (#1567)
* Added user label support in sql_database_instance (#1372)

* Fixes #1372
2018-05-30 15:32:11 -07:00
Vincent Roseberry
ebbae91b77
Convert instance_group self_link to v1 (#1549) 2018-05-30 15:25:07 -07:00
Ian L
b4be2fa124 Add basic update for google_kms_crypto_key resource (#1511)
* Add basic update for `google_kms_crypto_key` resource

Prior to this commit, any changes to `rotation_period` would
force a new resource as no `Update` was defined for the resource.
This commit introduces a basic `Update` through calling the
`Patch` service method. It only modifies the `rotation_period`,
and `next_rotation_time` at the moment, but this is reflective
of what is "allowed" on https://console.cloud.google.com/security/kms.

* Remove unused `Purpose` value in `CryptoKey`

We are only patching the `rotation_period`, and `next_rotation_time`,
so that value will not be affected.

* nit: format `Patch` operation to be in a single line

* Extend `TestAccKmsCryptoKey_rotation` test steps

- Test change in rotation period
- Test removal of rotation period

* Do not parse `NextRotationTime` if it is not set

* remove ForceNew: false
2018-05-29 17:20:32 -07:00
Vincent Roseberry
e4c9b2d4b1
Add a DiffSupress for ipv6 shortening (#1551) 2018-05-29 14:43:39 -07:00
Vincent Roseberry
8bb494520f
project field for google_project_services can use the default provider project (#1553) 2018-05-29 14:26:58 -07:00
Vincent Roseberry
8c2f47ba69
Remove label from bucket (#1550)
* Remove label from bucket

* Remove debugging statement

* Fix typos
2018-05-29 14:23:37 -07:00
Dana Hoffman
dc46348d67
Add support for custom request headers in backend services (#1537)
* revendor compute beta apis

* changes to subnetwork iam from api revendoring

* add support for custom request headers in backend services
2018-05-29 13:29:40 -07:00
Dana Hoffman
1af48cddf5
add disabled property to firewall (#1536)
* add disabled property to firewall

* add test and change update to patch
2018-05-29 13:27:29 -07:00
Jamie Lennox
cd83bab7dc Use the project defined in the trigger_template when creating trigger (#1556)
When creating a trigger by using the project defined in the schema we
enforce that the repo must be in that same project. We should be looking
at the project defined in the trigger_template data and falling back to
that first project if not found.

Closes: #1555
2018-05-29 11:38:12 -07:00
Vincent Roseberry
f0857a09d5
Accept subnetwork name only in forwarding rule (#1552)
* Accept subnetwork name only in forwarding rule

* Fix acceptance test
2018-05-29 11:00:04 -07:00
Dana Hoffman
974c3f7646
Add GKE Shared VPC support (#1528)
All this needed was to allow setting the network/subnetwork to a self link.

~WIP for now because I want to run the tests in CI.~ Tests are passing.
2018-05-23 16:47:17 -07:00
Paddy
53450244c3
Merge pull request #1523 from terraform-providers/paddy_project_read_fix
Ignore API not enabled errors when reading project
2018-05-23 14:53:48 -07:00
Paddy
23acaf2dd3
Merge pull request #1524 from terraform-providers/paddy_eventual_services
Guard against eventually consistent services
2018-05-23 14:53:14 -07:00
The Magician
488b9e86f3 Redis resource (#1485)
<!-- This change is generated by MagicModules. -->
/cc @danawillow
2018-05-23 11:25:48 -07:00
Paddy Carver
4ec59fccea Guard against eventually consistent services
When enabling services, after the waiter returns, list the enabled
services and ensure the ones we enabled are in there. If not, retry. May
not always resolve #1393, but should help. Unfortunately, the real
answer is probably either:

1. For us to try and get the API updated to only return the waiter when
the service will consistently be available. I don't know how feasible
this is, but I'm willing to open a ticket.
2. For us to build retries into ~all our resources to retry for a set
amount of time when a service not enabled error is returned. This would
greatly slow down the provider in the case of the service legitimately
not being enabled, but is how other providers handle this class of
problem.

Unfortunately, due to the eventual consistency at play, this is a hard
issue to reproduce and prove, though it matches with my
experience--while testing this patch, one of the tests failed with the
error that the serviceusage API hadn't been enabled, but only on step 4
of the test, when calls had already succeeded. Which suggests eventual
consistency, to me. Regardless, this patch shouldn't _hurt_ and should
mostly be an imperceptible change to users, and should make instances
like #1393 less likely.
2018-05-23 04:01:05 -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
Paddy Carver
4c40febd4b Ignore API not enabled errors when reading project
When reading a project, both App Engine and Billing would fail if
_neither_ the default project the provider was configured with nor the
project being targeted had the App Engine Admin or Billing APIs
(respectively) enabled. We didn't catch this because our source project
obviously has both enabled.

This fixes the matter by checking the error returned from each of those,
and if it looks like an API not enabled error, logging it at warning
level instead of returning it as an error, which will let the read
proceed as usual.
2018-05-22 16:59:33 -07:00
emily
acaf767f33 Fix panic on empty maintenance window (#1507)
* fix maintenance window panic

* tiny cleanup
2018-05-22 13:31:39 -07:00
Shinichi TAMURA
028ec27ccf Fixed region_backend_service to calc hash using relative path (#1491)
Along the change on region_backend_service.backend[].group to use DiffSuppressFunc (#1487), we also need to change hash function, as [pointed out](https://github.com/terraform-providers/terraform-provider-google/pull/1487#issuecomment-389000239).

Fixed this in a same way regular backend services do.
https://github.com/terraform-providers/terraform-provider-google/blob/v1.12.0/google/resource_compute_backend_service_migrate.go#L102-L103
2018-05-22 13:05:38 -07:00
Tenorio Orta JM
9ac7acc164 Added name and project_id regex validations (#1498) (#1519) 2018-05-22 12:45:28 -07:00
Nathan McKinley
ca83ea530a
Revert #1510 and #1508. (#1515) 2018-05-21 13:09:15 -07:00
Dana Hoffman
bc8f3046ad
initial tf changes needed to support redis (#1513) 2018-05-21 12:01:06 -07:00
Paddy
cd7364d649
Merge pull request #1503 from terraform-providers/paddy_app_engine_app
Add App Engine Application support
2018-05-18 17:12:34 -07:00
Paddy Carver
98b6323342 Fix suggestions from @ndmckinley. 2018-05-18 17:01:40 -07:00
Nathan McKinley
6cc720cad3
File moves to prepare for removing 'resourceManager' hack in Magic Modules. (#1508) 2018-05-18 16:32:05 -07:00
Christoph Tavan
0bcb01266c Add google_logging_project_exclusion resource (#990)
Adds support for log exclusions in billingAccounts, organizations,
folders and projects, see:
https://cloud.google.com/logging/docs/exclusions

```
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./google -v -run=Exclusion -timeout 120m
=== RUN   TestAccLoggingBillingAccountExclusion_basic
=== PAUSE TestAccLoggingBillingAccountExclusion_basic
=== RUN   TestAccLoggingBillingAccountExclusion_update
=== PAUSE TestAccLoggingBillingAccountExclusion_update
=== RUN   TestAccLoggingFolderExclusion_basic
=== PAUSE TestAccLoggingFolderExclusion_basic
=== RUN   TestAccLoggingFolderExclusion_folderAcceptsFullFolderPath
=== PAUSE TestAccLoggingFolderExclusion_folderAcceptsFullFolderPath
=== RUN   TestAccLoggingFolderExclusion_update
=== PAUSE TestAccLoggingFolderExclusion_update
=== RUN   TestAccLoggingOrganizationExclusion_basic
=== PAUSE TestAccLoggingOrganizationExclusion_basic
=== RUN   TestAccLoggingOrganizationExclusion_update
=== PAUSE TestAccLoggingOrganizationExclusion_update
=== RUN   TestAccLoggingProjectExclusion_basic
=== PAUSE TestAccLoggingProjectExclusion_basic
=== RUN   TestAccLoggingProjectExclusion_disablePreservesFilter
=== PAUSE TestAccLoggingProjectExclusion_disablePreservesFilter
=== RUN   TestAccLoggingProjectExclusion_update
=== PAUSE TestAccLoggingProjectExclusion_update
=== CONT  TestAccLoggingBillingAccountExclusion_basic
=== CONT  TestAccLoggingOrganizationExclusion_update
=== CONT  TestAccLoggingProjectExclusion_update
=== CONT  TestAccLoggingFolderExclusion_folderAcceptsFullFolderPath
=== CONT  TestAccLoggingOrganizationExclusion_basic
--- PASS: TestAccLoggingProjectExclusion_update (3.60s)
--- PASS: TestAccLoggingOrganizationExclusion_update (4.40s)
=== CONT  TestAccLoggingFolderExclusion_update
--- PASS: TestAccLoggingOrganizationExclusion_basic (1.90s)
=== CONT  TestAccLoggingFolderExclusion_basic
--- PASS: TestAccLoggingBillingAccountExclusion_basic (6.21s)
=== CONT  TestAccLoggingBillingAccountExclusion_update
--- PASS: TestAccLoggingBillingAccountExclusion_update (5.90s)
=== CONT  TestAccLoggingProjectExclusion_disablePreservesFilter
--- PASS: TestAccLoggingProjectExclusion_disablePreservesFilter (3.90s)
=== CONT  TestAccLoggingProjectExclusion_basic
--- PASS: TestAccLoggingFolderExclusion_folderAcceptsFullFolderPath (16.67s)
--- PASS: TestAccLoggingProjectExclusion_basic (1.96s)
--- PASS: TestAccLoggingFolderExclusion_basic (15.30s)
--- PASS: TestAccLoggingFolderExclusion_update (18.35s)
PASS
ok  	github.com/terraform-providers/terraform-provider-google/google	22.810s
```
2018-05-18 08:55:04 -07:00
The Magician
56481d8316 Add liens resource. (#1484) 2018-05-17 16:33:30 -07:00
Paddy
f78de6b76e Drop the resources we can't support.
IAP has no reasonable support policy, because PATCH is broken, and IAP
must be configured with an OAuth2 client ID and secret that belongs to
the project the app is associated with. There's no programmatic way to
create Clients. But we create the project and the app at the same time,
and we can't update because PATCH is broken. So this just drops IAP. It
also forces all our updates to ForceNew, because we can't update.

Also, adds more test coverage and docs, and fixes import by not relying
on the config for setting app engine info in state.
2018-05-17 14:47:34 -07:00
emily
d360236a8d
Allow bigquery regional location (#1496)
* Allow bigquery regional location

* remove stale comment about location
2018-05-15 14:36:12 -07:00
emily
3cc868b4a9
Fix order of getting project for storage notification topic (#1490)
* fix getting project for storage notification topic

* add more documentation for storage notification topic
2018-05-15 13:30:59 -07:00
Shinichi TAMURA
2d580ea0a2 Compare region_backend_service.backend[].group as a relative path (#1487) 2018-05-14 16:59:27 -07:00
Nathan McKinley
d47687f574
Check current status during apply-time diff. (#1474) 2018-05-14 16:31:24 -07:00
leo-baltus
4a0849eb86 Fixed typo (#1488)
google_project_iam_policy_binding and google_project_iam_policy_member should
read google_project_iam_binding and google_project_iam_policy_member
2018-05-14 10:11:11 -07:00
Vincent Roseberry
dc029dd329
Improve testing for forwarding rule (#1482) 2018-05-14 10:07:59 -07:00
The Magician
5e0d39225f Release generated SSLPolicy (#1478) 2018-05-14 09:52:33 -07:00
Paddy Carver
02a4259c39 Add basic test and fix bugs.
Add a test case that exercises the obvious path, and fix the some of the
bugs it exposed.
2018-05-13 22:49:26 -07:00
The Magician
722c21d78f Re-release generated vpn_gateway (#1479) 2018-05-11 12:06:17 -07:00
The Magician
fff3d612d6 Codegen update: allow all properties to be used in Updates. (#1443) 2018-05-10 15:34:24 -07:00
Nao YONASHIRO
1e38b21854 fix: replica_configuration.password to be sensitive (#1468) 2018-05-10 15:31:07 -07:00