Commit Graph

88 Commits

Author SHA1 Message Date
Paddy
e03493ddd4 Remove create_timeout backwards incompatibilities.
A new create_timeout attribute was added that had some backwards
incompatibilities, and as per discussion in #10823, it was determined we
could make upgrading to 0.8.x easier by fixing them, without really
losing any functionality.

Because create_timeout is not something stored or transmitted to the
API, it's not something we need a ForceNew on. Also, because an update
wouldn't result in an API call, we can add a state migration to avoid a
false positive diff that requires people to plan and apply but doesn't
actually make an API call.
2016-12-19 23:49:53 -08:00
stack72
a40d538584 Merge branch 'google-xpn' of https://github.com/danawillow/terraform 2016-12-13 19:15:54 +00:00
Paddy
121b587aec Fix instance/template metadata support
Update our instance template to include metadata_startup_script, to
match our instance resource. Also, we've resolved the diff errors around
metadata.startup-script, and people want to use that to create startup
scripts that don't force a restart when they're changed, so let's stop
disallowing it.

Also, we had a bunch of calls to `schema.ResourceData.Set` that ignored
the errors, so I added error handling for those calls. It's mostly
bundled with this code because I couldn't be sure whether it was the
root of bugs or not, so I took care of it while addressing the startup
script issue.
2016-12-05 02:45:28 -08:00
Aditya Anchuri
2c43213d1c Added create timeout for compute images and instances
- Prevents the corresponding terraform resource from timing out when the
  images or instances take longer than the default of 4 minutes to be
  created
2016-11-12 18:30:02 -08:00
Paddy
0e2c4da3e2 provider/google: throw an error for invalid disks
When configuring an instance's attached disk, if the attached disk has
both the disk and type attributes set, it would previously cause
terraform to crash with a nil pointer exception. The root cause was that
we only instantiate the InitializeParams property of the disk if its
disk attribute isn't set, and we try to write to the InitializeParams
property when the type attribute is set. So setting both caused the
InitializeParams property to not be initialized, then written to.

Now we throw an error explaining that the configuration can't have both
the disk and the type set.

Fixes #6495.
2016-11-07 16:11:00 -08:00
Dana Hoffman
0c026275e3 Add subnetwork_project field to allow for XPN in GCE instances 2016-10-27 08:25:58 -07:00
Matt Morrison
c502799c23 Make network attribute more consistent.
Some google resources required network be refernced by resource URL (aka self_link), while others required network name.
This change allows either to be supplied.

DRY it out, and add a fix for #5552.
2016-09-05 08:02:54 +12:00
Evan Brown
5254774342 provider/google: Support static private IP addresses (#6310)
* provider/google: Support static private IP addresses

The private address of an instance's network interface may now be specified.
If no value is provided, an address will be chosen by Google Compute Engine
and that value will be read into Terraform state.

* docs: GCE private static IP address information
2016-08-08 13:01:31 +12:00
Evan Brown
ace4cf2831 providers/google: Allow custom Compute Engine service account
This commit allows an operator to specify the e-mail address of a service
account to use with a Google Compute Engine instance. If no service account
e-mail is provided, the default service account is used.

Closes #7985
2016-08-04 19:25:28 -07:00
Igor Wiedler
a3188d0885 [provider/google] Use resource-specific project when waiting for creation
Creating most google cloud resources uses the compute_operation to
wait for the creation to complete. However, the computeOperationWait*
functions always uses the global `config.Project`, instead of the resource-
specific one.

This means that creating resource in a project other than the main one
fails with a 404 on the operation resource.

This patch uses the project from google_compute_instance instead of the
global one.
2016-06-10 11:55:21 +02:00
Seth Vargo
e2c5e9a1d5 Update documentation to include new "project" attribute
This commit also normalizes the format we display attributes.
2016-04-10 17:34:15 -04:00
Seth Vargo
9756d62378 Accept "project" as an attribute to GCP resources
This is the first step in removing the config dependency on "project".
This change is backwards-compatible because the value for this new
attribute defaults to the value from the provider.
2016-04-10 13:01:24 -04:00
Matt Morrison
b5c5cbd5d4 Add more acceptance tests, and fix some test cases 2016-02-18 08:37:58 -08:00
Matt Morrison
9fd044c0f0 Update google resources where necessary to make use of subnetworks, update som docs 2016-02-18 08:37:58 -08:00
Trevor Pounds
a77d60e006 Use built-in schema.HashString. 2016-02-07 16:29:34 -08:00
Lars Wander
57052bd79b Merge pull request #4265 from lwander/gcp-assigned-nat-ip
provider/google: provide assigned_nat_ip as well as nat_ip
2016-01-13 17:13:16 -05:00
Lars Wander
af69d1cd76 provider/google: Updated Read(..) behavior to handle deleted resources 2016-01-07 10:39:04 -05:00
Lars Wander
1c418814e3 provider/google: Fix project metadata sshkeys from showing up 2016-01-05 11:37:52 -05:00
stack72
76e0099e3c Fixing Gofmt errors 2015-12-17 00:43:50 +01:00
Lars Wander
30f67eae3b provider/google: provide assigned_nat_ip as well as nat_ip 2015-12-11 12:57:18 -05:00
Matt Morrison
9afdb563a7 Add logging when instance no longer exists 2015-11-06 10:15:35 +13:00
Matt Morrison
547331ebc1 Issue #3742 - terraform destroy fails if Google Compute Instance no longer exists 2015-11-05 12:38:17 +13:00
clint shryock
dc2a87c505 update with go fmt 2015-10-29 17:10:44 -05:00
Lars Wander
17e36a2b84 provider/google: Added scheduling block to compute_instance 2015-10-26 16:16:06 -04:00
Paul Hinze
aff63007d2 provider/google: one more fix to GCE metadata
In #3501 @lwander got us almost all the way there, but we still had
tests failing. This seemed to be because GCE sets
`metadata.startup-script` to a blank string on instance creation, and if
a user specifies any `metadata` in their config this is seen as the
desired full contents of metadata, so we get a diff trying to remove
`startup-script`.

Here, to address this, we just proactively remove the "startup-script"
key from `Read`, and then we enforce that "metadata_startup_script"
is the only way to configure startup scripts on instances.
2015-10-14 21:34:33 -05:00
Lars Wander
4182880ca5 Provider GCE, fixed metadata state update bug 2015-10-14 12:47:54 -05:00
Radek Simko
0c20852709 gofmt files from recently merged PRs 2015-10-07 13:35:06 -07:00
Lars Wander
05503f4f9c Refactored wait code to delete duplicated code & share functionality 2015-09-24 16:30:12 -04:00
Lars Wander
7eb5ad3bb8 Refactored project/instance metadata to use same code whenever possible
Also added optimistic locking to instance metadata
2015-09-15 14:06:26 -04:00
Clint Shryock
a9f813a93b provider/google: Misc. cleanups for tests to pass 2015-08-31 09:06:25 -05:00
Dave Cunningham
a4037a0f61 Add ForceNew metadata_startup_script field 2015-07-01 21:24:34 -04:00
Mitchell Hashimoto
14ff9f2912 fmt 2015-06-23 22:31:24 -07:00
Dave Cunningham
27319e1366 Allow local SSDs, Fix #1088 2015-05-11 21:40:37 -04:00
Dave Cunningham
b39460bd62 Use a set for service account scopes. Fix #1759 2015-04-30 21:21:21 -04:00
Mitchell Hashimoto
b99fce59e3 Merge pull request #1426 from dainis/master
provider/google: add additional options to google provider
2015-04-22 08:50:22 +02:00
Mitchell Hashimoto
0f7483ab54 Merge pull request #1484 from sparkprime/deprecate-network
deprecate google instance 'network' attribute in favor of network_interface
2015-04-22 08:49:04 +02:00
Paul Hinze
a985b68edb google: simplify instance metadata schema
It doesn't need to be a List of Maps, it can just be a Map.

We're also safe to remove a previous workaround I stuck in there.

The config parsing is equivalent between a list of maps and a plain map,
so we just need a state migration to make this backwards compatible.
2015-04-15 11:01:35 -05:00
Dave Cunningham
d55ac06b4f deprecate google instance 'network' attribute in favor of network_interface 2015-04-10 17:03:51 -04:00
Dave Cunningham
f1e26ba5de Avoid 'source' being undefined in legacy network Read 2015-04-09 13:29:59 -04:00
Dainis Tillers
74b4f960cb Just removing network refresh wont cut it, value from config must be used 2015-04-08 15:38:07 +03:00
Dainis Tillers
28e29aec19 Fix #1394, network value for network_interface isn't a computed value and there is no need to refresh it each time instance data is read 2015-04-08 15:29:46 +03:00
Dainis Tillers
c3317e3560 Added - disk device name 2015-04-08 14:34:37 +03:00
Mitchell Hashimoto
52b43d550a Merge pull request #1239 from BashtonLtd/gce_fix_false_bools
providers/google: Updates to GCE Instances and Instance Templates to allow for false bools.
2015-03-26 10:20:52 -07:00
Mitchell Hashimoto
2acedf19a6 Merge pull request #1154 from stuntgoat/gce-add-network
providers/google: add network field to the network_interface
2015-03-26 10:19:00 -07:00
Mitchell Hashimoto
a8917b2b34 Merge pull request #1236 from BashtonLtd/gce_update_imports
Update Google API import to point to the new location.
2015-03-26 10:14:33 -07:00
Nolan Darilek
0cca21d927 Add disk size to google_compute_instance disk blocks. 2015-03-24 11:45:20 -05:00
David Watson
8cfd51bed7 Updates to GCE Instances and Instance Templates to allow for false values to be set for the auto_delete setting. 2015-03-18 17:50:03 +00:00
David Watson
56c5854e5b Update Google API import to point to the new location. 2015-03-18 17:10:39 +00:00
stungtoat
86913b0363 add network field to the network_interface 2015-03-06 22:13:07 -08:00
Mitchell Hashimoto
dee37aa1dd providers/google: set only top-level configs for lists [GH-929] 2015-03-02 10:00:24 -08:00