Commit Graph

86 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
55c7a8b332 Hard remove broken Removed fields, fix 0.12 configs (#3437)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-04-15 18:14:01 -07:00
The Magician
5c925718d1 012 instance from template (#3434)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-04-15 14:21:24 -07:00
The Magician
f0941f7138 Remove 'Set' from fields where it doesn't do anything (#3364)
<!-- This change is generated by MagicModules. -->
Original Author: @chrisst
2019-04-02 13:58:53 -07:00
The Magician
23db6b0c12 Fix golangci-lint errors (#3059)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-02-14 16:00:35 -08:00
The Magician
f9903ee041 google_compute_instance change a removed field from optional -> computed (#3010)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2019-02-06 16:22:35 -08:00
The Magician
ced540ceca Add hostname field to compute_instance (#2952)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-01-29 09:44:21 -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
The Magician
caa1bd9664 send scheduling block with automaticrestart if there is none in cfg (#2638) 2018-12-20 17:22:22 -08:00
The Magician
77e87d0f9b Remove google_compute_instance*.address (#2595)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-20 17:22:22 -08:00
Chris Stephens
ae09a200c7 deprecate address as originally intended 2018-12-20 17:22:22 -08:00
Chris Stephens
b8de3fd850 Deprecate network fields (#2235)
* removing old removed network fields

* Remove ipv4range option
2018-12-20 17:22:22 -08:00
Chris Stephens
a0e2d50331 Change deprecated fields back to 'Removed' (#2241)
* Change deprecated fields back to 'Removed'

To provide a better user experience we're going to mark the fields as removed
so that users will get a more accurate error message. We will follow up a while
later to actually remove them from schema.
2018-12-20 17:22:22 -08:00
Chris Stephens
50fe1b6c83 Remove address and create_timeout from instance (#2219) 2018-12-20 17:22:22 -08:00
Riley Karson
8c42015451 Make google_compute_instance metadata authoritative. (#2208) 2018-12-20 17:22:22 -08:00
Riley Karson
a4a453dc1b
Deprecate assigned_nat_ip in compute_instance family (#2155)
Part of #2143
2018-10-02 16:07:28 -07:00
Riley Karson
41d47ec8bb
Deprecate address in compute_instance family, undeprecate network_ip (#2096)
Also remove a duplicate instance test I noticed for ephemeral ips.
2018-09-26 11:19:25 -07:00
Nathan McKinley
f05d62c89e
Enable multiple alias IP ranges for compute instance. (#2029)
* Enable multiple alias IP ranges for compute instance.
2018-09-11 17:37:35 -07:00
emily
83406c3c5f
fix possible error from nil check (#1942) 2018-08-27 16:22:06 -07:00
Walker
c810e4b408 provider: Ensures schema.TypeMap elements are schema.Schema (#1835) 2018-08-14 16:53:39 -07:00
Dana Hoffman
547245bada allow setting instance scheduling booleans to false 2018-07-16 13:54:47 -07:00
Dana Hoffman
a6198a0b60
prereqs for regional disks (#1753)
In testing an upcoming `google_compute_region_disk` resource, I had to make these changes. Checking them in separately so that when the magician runs, these changes will already be a part of TF.
2018-07-10 17:10:05 -07:00
Dana Hoffman
7e04cee958
add new compute_instance_from_template resource (#1652)
This was done as its own resource as suggested in slack, since we don't have the option of making all fields Computed in google_compute_instance. There's precedent in the aws provider for this sort of thing (see ami_copy, ami_from_instance).

When I started working on this I assumed I could do it in the compute_instance resource and so I went ahead and reordered the schema to make it easier to work with in the future. Now it's not quite relevant, but I left it in as its own commit that can be looked at separately from the other changes.

Fixes #1582.
2018-06-28 16:09:23 -07:00
Paddy Carver
53cc357b4c Fix network_tier tests.
Make network_tier computed, so when it's not specified we don't get a
permadiff.

Always store v1 self_links, so we don't get a permadiff.
2018-06-05 17:49:33 -07:00
Dana Hoffman
2f5c77cd7f add support for network tiers (#1530)
* add support for network tiers

* Update resource_compute_forwarding_rule.go
2018-06-05 12:35:44 -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
aa2626b490 Revert "remove switch statements between api versions for compute"
This reverts commit bf1b3a24e8c1cac832e74d9d0e145c7010a4c2f1.
2018-05-04 07:51:45 -07:00
Dana Hoffman
30409d315e
Remove switch statements between api versions for compute (#1422) 2018-05-03 12:24:21 -07:00
Nathan McKinley
0a02d8eaef
Fix failing compute tests which use AccessConfigs (#1383) 2018-04-25 13:26:24 -07:00
Nathan McKinley
d3bbfbd22b
Add DNS PTR record to Compute Instance (#1349) 2018-04-20 11:14:38 -07:00
Dana Hoffman
8ad6f15478
fix error introduced when attached disks are deleted out of band (#1301)
* fix error introduced when attached disks are deleted out of band

* add comment about nil check
2018-04-06 17:40:49 -07:00
Nick Jacques
8ada4ffdb2 Add deletion_protection wrapper for deleting instance (#1211) 2018-03-16 14:09:21 -07:00
Nick Jacques
46a3d2fd47 Add deletion protection to resource_compute_instance (#1205) 2018-03-16 11:57:42 -07:00
Dana Hoffman
313eb0fb89
Check set equality for service account scope changes (#1130)
* add debug printfs

* more logs for debugging

* check set equality for service acct scope changes

* revert changes to region igm

* style things
2018-02-27 14:29:00 -08:00
Dana Hoffman
2e665f2f35
add support for updating alias ips in instances (#1084) 2018-02-14 15:48:47 -05:00
Nathan McKinley
f7851162a4
Don't set metadata_startup_script in some cases. (#1081) 2018-02-13 23:55:37 -08:00
Chase
e1323489ba Feature: select compute instance attached disk mode (#947) 2018-02-12 10:56:06 -08:00
Dana Hoffman
3b753cefa2
Add update support for machine type, min cpu platform, and service accounts (#1005)
* Add update support for compute instance fields that require the machine to be stopped

* add warnings in docs about stopping the instance before updating

* add allow_stopping_for_update field
2018-01-24 12:50:39 -08:00
Jacob Straszynski
939ba6d365 skip guest accelerators if count is 0. (#866)
* skip guest accelerators if count is 0.

Instances in instance groups in google will fail to provision, despite
requesting 0 GPUs. This came up for me when trying to provision
a similar instance group in all available regions, but only asking for
GPU's in those that support them by parameterizing the `count` and
setting it to 0.

This might be a violation of some terraform principles. For example,
testing locally with this change `terraform` did not recognize that
indeed my infra needed to be re-deployed (from it's pov, I assume it
believes this because inputs hadn't changed). Additionally, there may be
valid reasons for creating an instance template with 0 gpu's that can be
tuned upwards.

* Add guest accelerator skip test for instances.

* do not leave empty pointers to guest accelerators.

* attempt to clear guest accelerator diff

* conditionally customize diff for guest accels
2018-01-23 11:51:36 -08:00
Vincent Roseberry
681cc72f38
Read compute instance boot disk initialization params from API (#948)
* read boot disk initialization param from API

* make fmt

* Mark the initialize_params list as computed to support boot source

* Ensure private family test follow naming pattern

* Improve docs
2018-01-17 13:23:24 -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
James McGill
bc266979d4 Revert "Ensure Elem is always either a *Schema or *Resource (#929)" (#950)
This reverts commit a3352655ac.
2018-01-12 10:09:06 -08:00
James McGill
a3352655ac Ensure Elem is always either a *Schema or *Resource (#929)
* Ensure Elem is always either a *Schema or *Resource

* Revert vendor file
2018-01-08 12:48:26 -08:00
Vincent Roseberry
dab491d28d
Make zone field consistent and truly optional for all resources (#914) 2018-01-03 16:18:40 -05:00
Vincent Roseberry
c1d9bb24c9
Support import in compute instance (#873) 2017-12-19 14:33:30 -08:00
Vincent Roseberry
d2289c2ca1
Add configurable timeouts to google_compute_instance (#856) 2017-12-13 17:03:15 -08: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
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
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