Commit Graph

28 Commits

Author SHA1 Message Date
The Magician
98d2972c31 Add Kms bootstrap step for terraform tests (#2837)
Signed-off-by: Modular Magician <magic-modules@google.com>
2019-01-08 18:32:27 -08:00
The Magician
2ab6d1995f Add = to map declarations in examples/tests (#2755)
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
2018-12-27 07:51:23 -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
Chris Stephens
9be729fb78 support KMS encryption for instance templates 2018-12-20 17:22:22 -08:00
Nathan McKinley
902675c324 Reverting 1.20 and 1.19 cherrypick branches. 2018-12-20 17:22:22 -08:00
Chris Stephens
49d8d6f2f3 support KMS encryption for instance templates 2018-12-12 17:23:35 -08:00
Paddy Carver
ee4ec86bef Fix error in instance template read.
Flattening disks involves taking the relative link of each disk. This
only works if you start from a self_link, but we were starting from
anything that resolveImage returns, which includes several
not-self_links.

This PR adds a test that shows the failure, and then fixes it by
expanding the output back out to a self_link before getting the relative
link from it.
2018-10-02 14:45:19 -07:00
Dana Hoffman
250cfa351c
fix instance template interaction with regional disks, make docs more clear about valid values (#2138) 2018-10-01 11:07:56 -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
Paddy Carver
be76ffaa78 Fix whitespace, really.
Tabs v spaces strikes again.
2018-08-21 13:36:04 -07:00
Paddy Carver
dd56795f2a Use family, not name, in image data source. 2018-08-14 11:18:39 -07:00
Paddy Carver
a13bcfbda1 Start updating to use the latest debian release. 2018-08-13 10:31:18 -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
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
52462382c9
Refactor import tests for the remaining compute resources (#909)
* Improve instance group manager import tests

* Improe instance template & project metadata import test

* Improve region autoscaler import test

* Improve router interface import test

* Improve router peer import test

* Improve SSL certs import test

* Improve http & https target proxy import tests

* Improve target pool import test

* Improve url map import test

* Improve target ssl & tcp proxy import test

* Add import test for instance template disk
2018-01-03 09:26:55 -05:00
Nathan McKinley
5766f2b107
Remove all instances of GOOGLE_XPN_HOST_PROJECT environment variable. (#815)
Remove all instances of GOOGLE_XPN_HOST_PROJECT environment variable.

Instead of GOOGLE_XPN_HOST_PROJECT being required to run some tests, I added the ability to create and tear down the necessary project structure.
This allows us to remove one environment variable, and use two others which are already widely-required: org and billing ID.
2017-12-11 14:07:52 -08:00
Vincent Roseberry
12baa8766b
Add support for min_cpu_platform to instance_template (#808)
* Add support for min_cpu_platform to instance_template

* Set value in initializer

* Extract test min cpu platform value in a const
2017-12-01 12:03:19 -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
9930daa2af
Always use a function to create a test config (#785) 2017-11-27 16:32:00 -08:00
thomas
ecdb1de297 the XPN_* env. variable is no longer mandatory (#760)
Since this variable is only used for 3 tests, it doesn't make sense
to declare it as mandatory in the test config. Therefore, concerned tests
are now skipped if the variable is absent.
2017-11-17 10:32:46 -08:00
Joe Selman
4b77dca918 Revert "Revert "Add t.Parallel to all acceptance tests (#558)""
This reverts commit 8ab9d96d25 and revives
the original commit that adds t.Parallel to all acceptance tests. It
turns out test failures were unrelated to this change (rather, they were
related to quota issues).
2017-10-12 15:07:29 -07:00
Joe Selman
8ab9d96d25 Revert "Add t.Parallel to all acceptance tests (#558)"
This reverts commit 42de44592f. It appears
there might be thread-safety issues as panics have started occuring when
parallism is ramped up. Reverting for now while investigating.
2017-10-10 17:55:34 -07:00
Joe Selman
42de44592f Add t.Parallel to all acceptance tests (#558) 2017-10-10 16:28:00 -07:00
Joe Selman
e3ca8fbe59 Add labels to google_compute_instance_template (#515) 2017-10-09 10:17:15 -07:00
Dana Hoffman
bbad89afe6 Fix failing tests: instance templates still use disk (#504)
* instance templates still use the disk field

* more fixes
2017-09-30 19:42:15 -07:00
Paddy
fccae61d61 1.0.0 Deprecations, pt 2
Fix the CI tests we broke with the deprecations for 1.0.0, and update
the docs we missed. Also, update the examples.
2017-09-29 16:04:52 -07:00
Joe Selman
f9d0570168 Fix scheduling automatic restart, remove deprecated options (#248)
* Fix bug where scheduling.automatic_restart false is never used

* Remove deprecated automatic_restart value in favor of scheduling.automatic_restart

* Remove deprecated on_host_maintenance

* Correct bad var name

* Re-add removed schema values and marked as Removed

* Fix var to snake case

* Migrate empty scheduling blocks in compute_instance_template

* Shorten error message

* Use only one return value instead of two
2017-08-09 12:25:16 -07:00
Jake Champlin
66029ac431
Transfer google provider 2017-06-06 11:58:51 -04:00