Commit Graph

65 Commits

Author SHA1 Message Date
The Magician
5ce5686d49 Retry instance metadata on fingerprint mismatch. (#3372)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-04-24 14:01:47 -07:00
The Magician
59b08fb422 Add TPU Tensorflow datasource (#3325)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-27 16:26:07 -07:00
The Magician
ef974d2781 Add working retries for SQL operations where the operation has the error (#3298)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-03-22 16:38:34 -07:00
The Magician
8be6190ab7 Parse 409 error strings to determine retriable status (#3285)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-22 10:24:05 -07:00
The Magician
4708ab21b3 Fix CI problems for 0.12 SDK (#3252)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-03-15 16:34:30 -07:00
The Magician
0de6d2790c [terraform-conversions] Add compute_instance to conversions library (#3226)
<!-- This change is generated by MagicModules. -->
/cc @nstogner
2019-03-12 15:10:21 -07:00
The Magician
4f7decf1e0 Changes ancillary to supporting the Terraform mapper. (#3177)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-04 12:56:25 -08:00
The Magician
c727bc458c Handle operation timeouts, if it's the gcp api that's timing out. (#3159)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-03-01 12:03:36 -08:00
The Magician
69e445bd59 SHA256 encode compute_certificate's private keys (#2976)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-02-01 11:02:20 -08:00
The Magician
b31626a1a2 Retry SQL delete calls on 409 (#2811)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-01-07 16:44:54 -08:00
The Magician
4ecc56a301 Autogenerate google_cloudbuild_trigger (#2790) 2019-01-04 13:47:52 -08:00
The Magician
ff66afb6e8 Add Appengine's firewall rules. (#2738) 2019-01-02 16:44:08 -08:00
The Magician
91a513ab83 clean up operation code (#2734) 2018-12-26 17:42:37 -08:00
The Magician
9582532556 Remove inferred zone from region on Disk import (#2694)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
9e9524af70 Remove inferred region from igm (#2693)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
afc340e93e Remove duplicates from provider resource map, add dupe test (#2683)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
29c665d865 Various linter cleanups (conversions, unused, misspellings) (#2681)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
The Magician
1bafe6b8e0 added ignored_files and included_files to google_cloudbuild_trigger (#2553) 2018-12-20 17:22:22 -08:00
The Magician
ff16c8f4e0 Don't allow users to specify certain APIs in google_project_services (#2468)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
Paddy
c1d404ddc1
Merge pull request #1995 from terraform-providers/paddy_1916_diff_fix
Fix perma-diff on instance templates.
2018-10-02 14:13:15 -07:00
Harry Pidcock
65669fc6d6 Added Environment Variables configuration to Cloud Functions (#1830) 2018-09-10 17:37:43 -07:00
Paddy Carver
5cf6a5d131 Fix perma-diff on instance templates.
When using instance templates, if you use one of our image shorthands at
the moment, you'll get a perma-diff. This is because the config gets
resolved to another format before it is set in state, and so we need to
set that other format in state.

Unfortunately, resolving images requires network access, so we have to
do this with CustomizeDiff. CustomizeDiff was having trouble (I think?
More on this below) on setting a field as not ForceNew once the field
was already set, so I moved the decision for whether a field was
ForceNew or not into CustomizeDiff. I also resolved the old and new
images, and if they were the same, cleared the diff.

Unfortunately, you can't actually clear a field on a sub-block right
now. You have to clear top-level fields only. So this will currently
throw an error. I opened hashicorp/terraform#18795 to fix that. Once
that's merged, and we vendor it here, this patch fixes the problem.

If hashicorp/terraform#18795 doesn't get merged, the next best
workaround is to keep track of _all_ the fields under `disk` with a diff
in our CustomizeDiff, check whether they've all changed or not, and if
they've all changed, clear the changes on `disk`, which I _think_ will
resolve the issue. That's just a massive pain, unfortunately.
2018-09-05 17:35:44 -07:00
Dana Hoffman
8b71cecad7
fix retries for wrapped errors (#1760)
Turns out this block of code:
 2ea2baaedd/google/resource_google_project_services.go (L246-L307)
wasn't actually retrying on quota failures (429s) because it was getting wrapped, so our retry helper saw it as as non-retryable. This fixes that.
2018-07-12 11:19:49 -07:00
Dana Hoffman
34a68289cd
retry node pool writes on failed precondition (#1660)
Hypothetically fixes #1643.

@thomasriley, are you able to patch this change into your provider to see if it fixed the problem? I haven't been able to get a working repo so I haven't verified the fix yet.
2018-06-22 16:21:35 -07:00
Jonathan Pentecost
f8a3335bf9 service_account_key: regression fix for v1.14 (#1664)
Commit 8f31fec introduced a bug for the 'service_account_key' resource
where it required a project be set either in the provider or in the
resource for 'service_account_key', but a project isn't required if the
service account is a service account fully qualified name or a service
account email.

This PR relaxes the requirement that a project needs to be set for the
'service_account_key' resource, 'service_account' datasource and
'service_account_key' datasource, but will error if we try to build a
fully qualified name from a service account id when no project can be
found.

This also cleans up 'serviceAccountFQN' so it is slightly easier to
follow and return an error if there is no project but we need one to
build the service account fully qualified name.

Fixes: #1655
2018-06-18 13:37:41 -07:00
Jonathan Pentecost
8f31fec857 New datasource: service account and service account key (#1535) 2018-05-31 17:31:45 -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
The Magician
56481d8316 Add liens resource. (#1484) 2018-05-17 16:33:30 -07:00
Vincent Roseberry
dc029dd329
Improve testing for forwarding rule (#1482) 2018-05-14 10:07:59 -07:00
Dana Hoffman
8907321d60
Roll forward beta scaffolding PR (#1453)
* Revert "Merge pull request #1434 from terraform-providers/paddy_revert_beta"

This reverts commit 118cd71201, reversing
changes made to d59fcbbc59.

* add ConvertSelfLinkToV1 calls to places where beta links are stored
2018-05-09 11:24:40 -07:00
Paddy Carver
a91951d3f8 Revert "remove dead api version code and move things around"
This reverts commit 7e291ce8392dc2766a158dd8d70007dcf791aa44.
2018-05-04 07:54:08 -07:00
Dana Hoffman
d59fcbbc59
Remove switch statements between api versions for container; clean up dead version code (#1427)
* remove switch statements between api versions for container

* remove dead api version code and move things around
2018-05-03 21:51:54 -07:00
Vincent Roseberry
7fd468c034
Delete dead code (#1411) 2018-05-01 12:31:43 -07:00
Vincent Roseberry
e58e099b1a
Generate resource entries in ResourcesMap in provider.go for generated resources. (#1397) 2018-04-30 14:30:43 -07:00
Darren Haken
2b1b668953 #1300 Supporting regional clusters for node pools (#1320)
This PR also switched us to using the beta API in all cases, and that had a side effect which is worth noting, note included here for posterity.

=====
The problem is, we add a GPU, and as per the docs, GKE adds a taint to
the node pool saying "don't schedule here unless you tolerate GPUs",
which is pretty sensible.

Terraform doesn't know about that, because it didn't ask for the taint
to be added. So after apply, on refresh, it sees the state of the world
(1 taint) and the state of the config (0 taints) and wants to set the
world equal to the config. This introduces a diff, which makes the test
fail - tests fail if there's a diff after they run.

Taints are a beta feature, though. :) And since the config doesn't
contain any taints, terraform didn't see any beta features in that node
pool ... so it used to send the request to the v1 API. And since the v1
API didn't return anything about taints (since they're a beta feature),
terraform happily checked the state of the world (0 taints I know about)
vs the config (0 taints), and all was well.

This PR makes every node pool refresh request hit the beta API. So now
terraform finds out about the taints (which were always there) and the
test fails (which it always should have done).

The solution is probably to write a little bit of code which suppresses
the report of the diff of any taint with value 'nvidia.com/gpu', but
only if GPUs are enabled. I think that's something that can be done.
2018-04-24 17:55:21 -07:00
emily
7fd537db69
Fix IAM policy deletion/read for deleted resources (#1262)
* add util for handling wrapped/raw google api errors

* add 404 error handling to shared iam files

* fix errwrap calls in iam files

* fix import

* remove newlines, clear ID for removed state in iam binding
2018-03-27 16:41:44 -07:00
Shinichi TAMURA
fc6a821433 Suppress perpetual diff on logging sink filter with surrounding whitespaces (#1206) 2018-03-20 12:49:50 -04:00
Vincent Roseberry
4b1fdee504
Changes to handle autogeneration. (#1087)
* Add Set method to TerraformResourceData and ResourceDataMock

* Add Id() and SetId() to ResourceDataMock and TerraformResourceData

* Keep only name when reading region or zone field to handle api that returns self_link
2018-02-15 15:32:31 -08:00
Emily Ye
41a0fddfbd remove multiple locks from cluster update and add lock helper 2018-02-05 09:45:53 -08:00
Vincent Roseberry
629c53be03
Make get(Region|Project|Zone) method testable (#1040) 2018-02-02 10:55:43 -08:00
Emily Ye
5f3070e223 add diff suppress for empty network policy in container cluster 2018-01-31 14:36:03 -08:00
Vincent Roseberry
d0f5fec463
Standardize resource name extraction from self_link/uri (#939)
* Standardize resource name extraction from self_link/uri

* remove rebase artifact

* style improvement

* Fix merge issue
2018-01-17 10:45:28 -08:00
Vincent Roseberry
da3a6f13a1
Infers region from zone before using the provider-level region (#938) 2018-01-09 13:57:02 -08:00
Vincent Roseberry
283c8f89e3
Delete unused methods (#905) 2018-01-02 14:15:13 -05:00
Nathan McKinley
114b646fae
Enable 'zone' to be specified at the provider level instead of per-resource. (#816)
- Fetch Zone attribute any place where it *was* being fetched from the schema by
	combination schema / provider-level attribute.
- Allow region to be unspecified if zone is specified.
- Switch one example to using provider-level zone as an example.
- Make provider-level zone optional.  (Individual resources will fail if they can't find a zone.)
- Add tests for getZone and getRegion.
2017-12-06 14:30:04 -08:00
Vincent Roseberry
8f701c6ebb
Remove getNetworkName method and use ParseNetworkFieldValue instead (#802) 2017-11-29 10:54:10 -08:00
Dana Hoffman
50afa7b199
compute instance helpers / metadata cleanup (#797)
* get rid of getSubnetworkLink and getProjectAndRegionFromSubnetworkLink

* dedupe metadata flatteners

* update flattenMetadata comment
2017-11-29 09:47:42 -08:00
Nic Cope
94a405d179 Add Alias IP and Guest Accelerator support to Instance Templates (#639)
* Move AliasIpRange helpers into utils

To reflect the fact they'll be used by multiple resources.

* Pass Config to build helpers, not meta

It's the only thing meta is used for.

* Refactor getNetwork util methods to return early for the happy path.

* Update compute APIs

compute.Instance.MinCpuPlatform is now GA.

* Fix panic in TestComputeInstanceMigrateState

This seemed to be a pre-existing issue, i.e. I could repro it in master.

--- FAIL: TestComputeInstanceMigrateState (0.00s)
panic: interface conversion: interface {} is nil, not *google.Config [recovered]
        panic: interface conversion: interface {} is nil, not *google.Config

goroutine 85 [running]:
testing.tRunner.func1(0xc4205d60f0)
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:711 +0x2d2
panic(0x203acc0, 0xc4205d2080)
        /usr/local/Cellar/go/1.9.1/libexec/src/runtime/panic.go:491 +0x283
github.com/terraform-providers/terraform-provider-google/google.migrateStateV3toV4(0xc4205f2000, 0x0, 0x0, 0x0, 0x48, 0xc4205f2000)
        /Users/negz/control/go/src/github.com/terraform-providers/terraform-provider-google/google/resource_compute_instance_migrate.go:182 +0x2405
github.com/terraform-providers/terraform-provider-google/google.resourceComputeInstanceMigrateState(0x2, 0xc4205f2000, 0x0, 0x0, 0x0, 0x0, 0xe0000000000)
        /Users/negz/control/go/src/github.com/terraform-providers/terraform-provider-google/google/resource_compute_instance_migrate.go:48 +0x21a
github.com/terraform-providers/terraform-provider-google/google.runInstanceMigrateTest(0xc4205d60f0, 0x2260816, 0x8, 0x227d23a, 0x20, 0x2, 0xc4205ec0f0, 0xc4205ec120, 0x0,
 0x0)
        /Users/negz/control/go/src/github.com/terraform-providers/terraform-provider-google/google/resource_compute_instance_migrate_test.go:803 +0xc1
github.com/terraform-providers/terraform-provider-google/google.TestComputeInstanceMigrateState(0xc4205d60f0)
        /Users/negz/control/go/src/github.com/terraform-providers/terraform-provider-google/google/resource_compute_instance_migrate_test.go:71 +0xc84
testing.tRunner(0xc4205d60f0, 0x22d81c0)
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:789 +0x2de
FAIL    github.com/terraform-providers/terraform-provider-google/google 0.035s

* Use only the v1 API for resource_compute_instance

Alias IP ranges, Accelerators, and min CPU platform are now GA.

* Move common instance code into utils.go

Methods used by both resource_compute_instance and
resource_compute_instance_template are currently spread between their respective
files, and utils.go.

This commit moves them all into utils.go for the sake of consistency. It may be
worth considering an instance_common.go file or similar.

* Unify compute_instance and compute_instance_template network_interface and service_account code

This has the side effect of enabling Alias IP range support for
compute_instance_templates.

* Add tests for compute instance template Alias IP ranges

* Mark instance template region as computed

We compute it from the subnet its network interfaces are in. Note this
is not new behaviour - I believe it was erroneously missing the computed
flag.

* Support guest accelerators for instance templates

Since most of the code is already there.

* Add a test for using 'address' rather than 'network_ip' for instance templates

* Don't mark assigned_nat_ip as deprecated

* Remove network_interface schema fields that don't make sense for a compute instance template

* Add newline after count in instance template docs

* Don't try to dedupe guest accelerator expansion code

The API calls to Google to create guest accelerators take different values
for instances and instance templates. Instance templates don't have a zone
and can thus *only* be passed a guest accelerator name.

* Use ParseNetworkFieldValue instead of getNetworkLink

* Add support for parsing regional fields, and subnetworks specifically

Currently unused because subnetworks may have a separate project from that
of the instance using them, which complicates looking up the project field.

* Fall back to provider region when parsing regional field values

Also slightly refactors getXFromSchema field helper functions for readability.

* Revert to assigned_nat_ip in compute instance docs

* Add beta scaffolding to compute instance and compute instance template

Note these resources don't currently use beta features - this is futureproofing.

* Fix indentation in comment about instance template alias IP ranges

* Consolidate metadata helper functions in metadata.go

* Move compute instance (and template) related helpers into their own file
2017-11-28 10:01:27 -08:00
Nicki Watt
68f7d775c3 Add google_dataproc_job resource (#253)
* Add google_dataproc_job resource

* Correct state ref in docs

* make tests parallel

* cleanup, mostly whitespace related

* docs fmt
2017-11-21 09:32:43 -08:00
Dana Hoffman
2c8dbac663
Fix timeout issue with project services (#737)
* retry api enablement/disablement for 10 minutes

* retry to retryTime
2017-11-14 11:41:57 -08:00