-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add state migration from disk
to boot_disk/scratch_disk/attached_disk
#329
Conversation
The only example I've been able to find of a resource reaching out to the API for migration (in either GCP or AWS) was the projects migration, which (glancing quickly at the tests) may or may not be overly helpful to you. :/ |
Took another look at the projects one- the reason the test works is that it explicitly doesn't set the field needed to make it read from the API :-/ |
20f483f
to
a662479
Compare
All right, I got the tests to seed the data they need, so now there are actual tests. There are still a few more I want to add (for the different ways to find the attached disk) but this is at least ready for review, for now (I'll fix the travis error later too) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple questions here, but on the whole this looks amazing and really thorough.
@@ -40,7 +40,7 @@ func resourceComputeInstance() *schema.Resource { | |||
Update: resourceComputeInstanceUpdate, | |||
Delete: resourceComputeInstanceDelete, | |||
|
|||
SchemaVersion: 2, | |||
SchemaVersion: 4, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'm missing a migration here--where does this get set to 3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It never got set to 3, but there's a migration fn hanging out that migrates from 2 to 3 so the next unclaimed value is 4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
That sounds terrifying, only because it means there's dead code that we'll be turning on. But that also, that's not this PR's fault, and from what I can see, the code doesn't change that much.
Sounds good to me, let's just do some heavy manual testing prior to cutting the release to make sure we don't end up in a weird place.
if !ok && config.Project == "" { | ||
return nil, fmt.Errorf("could not determine 'project'") | ||
} | ||
project = config.Project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the project
attribute is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yup that would not work. Fixed :)
if !ok && config.Project == "" { | ||
return nil, fmt.Errorf("could not determine 'project'") | ||
} | ||
project = config.Project |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if the project
attribute is set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Thanks for approving! I came up with more code to review :P Let me know what you think, especially around splitting on the disk image relative path. (Also if you think this is ready to merge, feel free to do it without me- I'm going to be traveling tomorrow it's unclear how responsive I'll be. Otherwise if you have comments I'll try to get to them asap.) |
My concern with the way image URLs are being split is that there's a chance that custom images that have collisions between an image name and a family name could cause problems. That's really unlikely, though. Is it worth using [EDIT] I guess that doesn't fully canonicalize it... We could use that, however, then trim everything before Honestly, I think the best thing may be to just build a self_link out of it (assuming the default project, if necessary). |
Building a full self link would be tricky, because we don't always have enough data to be able to fill in the project (for example, we allow users to use the shorthand "global/images/family/debian-8" in place of the self link, which doesn't have its family debian-cloud anywhere in it). I could reuse the logic inside of |
} | ||
image := attributes[fmt.Sprintf("disk.%d.image", i)] | ||
|
||
// We know project and zone are set because we used them to read the instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we though? From what I saw, the instance attributes were never updated with the project if we inferred the project from the config.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, fixed.
Test output: ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./google -v -run=TestAccComputeInstanceMigrateState -timeout 120m === RUN TestAccComputeInstanceMigrateState_bootDisk 2017/09/28 10:32:35 [INFO] Requesting Google token... 2017/09/28 10:32:35 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 10:32:35 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 10:32:35 [INFO] -- Private Key Length: 1704 2017/09/28 10:32:35 [INFO] Instantiating GCE client... 2017/09/28 10:32:35 [INFO] Instantiating GCE Beta client... 2017/09/28 10:32:35 [INFO] Instantiating GKE client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 10:32:35 [INFO] Instantiating Google Storage Client... 2017/09/28 10:32:35 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Pubsub Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 10:32:35 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 10:32:37 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:32:47 [DEBUG] Got "DONE" when asking for operation "operation-1506619955952-55a434b493980-f71a3d9f-5af07b34" 2017/09/28 10:32:47 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 10:32:47 [DEBUG] Attributes before migration: map[string]string{"disk.#":"1", "disk.0.type":"pd-ssd", "disk.0.device_name":"persistent-disk-0", "disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "zone":"us-central1-f", "disk.0.disk":"disk-1", "disk.0.auto_delete":"false", "disk.0.size":"12", "disk.0.disk_encryption_key_raw":"encrypt-key"} 2017/09/28 10:32:47 [DEBUG] Attributes after migration: map[string]string{"boot_disk.0.device_name":"persistent-disk-0", "boot_disk.#":"1", "boot_disk.0.auto_delete":"false", "zone":"us-central1-f", "boot_disk.0.source":"instance-test-jnibab7wew", "boot_disk.0.disk_encryption_key_raw":"encrypt-key", "boot_disk.0.disk_encryption_key_sha256":"encrypt-key-sha"} 2017/09/28 10:32:48 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:32:58 [DEBUG] Got "RUNNING" when asking for operation "operation-1506619967913-55a434bffbc29-91006f7b-3e9d4d62" 2017/09/28 10:32:58 [TRACE] Waiting 2s before next try 2017/09/28 10:33:00 [DEBUG] Got "RUNNING" when asking for operation "operation-1506619967913-55a434bffbc29-91006f7b-3e9d4d62" 2017/09/28 10:33:00 [TRACE] Waiting 4s before next try 2017/09/28 10:33:05 [DEBUG] Got "RUNNING" when asking for operation "operation-1506619967913-55a434bffbc29-91006f7b-3e9d4d62" 2017/09/28 10:33:05 [TRACE] Waiting 8s before next try 2017/09/28 10:33:13 [DEBUG] Got "RUNNING" when asking for operation "operation-1506619967913-55a434bffbc29-91006f7b-3e9d4d62" 2017/09/28 10:33:13 [TRACE] Waiting 10s before next try 2017/09/28 10:33:23 [DEBUG] Got "DONE" when asking for operation "operation-1506619967913-55a434bffbc29-91006f7b-3e9d4d62" --- PASS: TestAccComputeInstanceMigrateState_bootDisk (47.78s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromSource 2017/09/28 10:33:23 [INFO] Requesting Google token... 2017/09/28 10:33:23 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 10:33:23 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 10:33:23 [INFO] -- Private Key Length: 1704 2017/09/28 10:33:23 [INFO] Instantiating GCE client... 2017/09/28 10:33:23 [INFO] Instantiating GCE Beta client... 2017/09/28 10:33:23 [INFO] Instantiating GKE client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 10:33:23 [INFO] Instantiating Google Storage Client... 2017/09/28 10:33:23 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Pubsub Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 10:33:23 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 10:33:24 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:33:34 [DEBUG] Got "DONE" when asking for operation "operation-1506620003502-55a434e1ec7b0-648d952e-128a40a5" 2017/09/28 10:33:35 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:33:46 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:33:46 [TRACE] Waiting 2s before next try 2017/09/28 10:33:48 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:33:48 [TRACE] Waiting 4s before next try 2017/09/28 10:33:52 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:33:52 [TRACE] Waiting 8s before next try 2017/09/28 10:34:00 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:00 [TRACE] Waiting 10s before next try 2017/09/28 10:34:10 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:10 [TRACE] Waiting 10s before next try 2017/09/28 10:34:20 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:20 [TRACE] Waiting 10s before next try 2017/09/28 10:34:31 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:31 [TRACE] Waiting 10s before next try 2017/09/28 10:34:41 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:41 [TRACE] Waiting 10s before next try 2017/09/28 10:34:51 [DEBUG] Got "DONE" when asking for operation "operation-1506620014466-55a434ec613d1-7aad5284-00279134" 2017/09/28 10:34:51 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 10:34:51 [DEBUG] Attributes before migration: map[string]string{"boot_disk.#":"1", "disk.#":"1", "disk.0.device_name":"persistent-disk-1", "disk.0.disk_encryption_key_raw":"encrypt-key", "disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "disk.0.disk":"instance-test-d934epici1", "zone":"us-central1-f"} 2017/09/28 10:34:51 [DEBUG] Attributes after migration: map[string]string{"zone":"us-central1-f", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-d934epici1", "attached_disk.0.device_name":"persistent-disk-1", "attached_disk.0.disk_encryption_key_raw":"encrypt-key", "attached_disk.#":"1", "attached_disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "boot_disk.#":"1"} 2017/09/28 10:34:52 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:35:02 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620091768-55a4353619cc1-5789ff88-204b616c" 2017/09/28 10:35:02 [TRACE] Waiting 2s before next try 2017/09/28 10:35:04 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620091768-55a4353619cc1-5789ff88-204b616c" 2017/09/28 10:35:04 [TRACE] Waiting 4s before next try 2017/09/28 10:35:08 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620091768-55a4353619cc1-5789ff88-204b616c" 2017/09/28 10:35:08 [TRACE] Waiting 8s before next try 2017/09/28 10:35:16 [DEBUG] Got "DONE" when asking for operation "operation-1506620091768-55a4353619cc1-5789ff88-204b616c" 2017/09/28 10:35:17 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:35:27 [DEBUG] Got "DONE" when asking for operation "operation-1506620116898-55a4354e110d0-bda892f3-2a37ee9b" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromSource (124.00s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromEncryptionKey 2017/09/28 10:35:27 [INFO] Requesting Google token... 2017/09/28 10:35:27 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 10:35:27 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 10:35:27 [INFO] -- Private Key Length: 1704 2017/09/28 10:35:27 [INFO] Instantiating GCE client... 2017/09/28 10:35:27 [INFO] Instantiating GCE Beta client... 2017/09/28 10:35:27 [INFO] Instantiating GKE client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 10:35:27 [INFO] Instantiating Google Storage Client... 2017/09/28 10:35:27 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Pubsub Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 10:35:27 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 10:35:29 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:35:39 [DEBUG] Got "DONE" when asking for operation "operation-1506620127592-55a4355843e41-ab9c7b00-d4c35413" 2017/09/28 10:35:39 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 10:35:39 [DEBUG] Attributes before migration: map[string]string{"boot_disk.#":"1", "disk.#":"1", "disk.0.image":"projects/debian-cloud/global/images/family/debian-8", "disk.0.disk_encryption_key_raw":"SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=", "disk.0.disk_encryption_key_sha256":"esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=", "zone":"us-central1-f"} 2017/09/28 10:35:39 [DEBUG] Attributes after migration: map[string]string{"boot_disk.#":"1", "attached_disk.0.device_name":"persistent-disk-1", "attached_disk.#":"1", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-4rbaev3ilf-1", "attached_disk.0.disk_encryption_key_raw":"SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=", "attached_disk.0.disk_encryption_key_sha256":"esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=", "zone":"us-central1-f"} 2017/09/28 10:35:40 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:35:50 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620139549-55a43563ab148-3c6fa591-eab47a24" 2017/09/28 10:35:50 [TRACE] Waiting 2s before next try 2017/09/28 10:35:52 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620139549-55a43563ab148-3c6fa591-eab47a24" 2017/09/28 10:35:52 [TRACE] Waiting 4s before next try 2017/09/28 10:35:56 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620139549-55a43563ab148-3c6fa591-eab47a24" 2017/09/28 10:35:56 [TRACE] Waiting 8s before next try 2017/09/28 10:36:04 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620139549-55a43563ab148-3c6fa591-eab47a24" 2017/09/28 10:36:04 [TRACE] Waiting 10s before next try 2017/09/28 10:36:14 [DEBUG] Got "DONE" when asking for operation "operation-1506620139549-55a43563ab148-3c6fa591-eab47a24" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromEncryptionKey (47.40s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromAutoDeleteAndImage 2017/09/28 10:36:14 [INFO] Requesting Google token... 2017/09/28 10:36:14 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 10:36:14 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 10:36:14 [INFO] -- Private Key Length: 1704 2017/09/28 10:36:14 [INFO] Instantiating GCE client... 2017/09/28 10:36:14 [INFO] Instantiating GCE Beta client... 2017/09/28 10:36:14 [INFO] Instantiating GKE client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 10:36:14 [INFO] Instantiating Google Storage Client... 2017/09/28 10:36:14 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Pubsub Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 10:36:14 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 10:36:16 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:36:26 [DEBUG] Got "DONE" when asking for operation "operation-1506620174882-55a435855d4d1-8dddf1a9-5ec14c91" 2017/09/28 10:36:26 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 10:36:26 [DEBUG] Attributes before migration: map[string]string{"zone":"us-central1-f", "boot_disk.#":"1", "disk.#":"2", "disk.0.image":"projects/debian-cloud/global/images/debian-8-jessie-v20170110", "disk.0.auto_delete":"true", "disk.1.image":"global/images/family/debian-8", "disk.1.auto_delete":"true"} 2017/09/28 10:36:26 [DEBUG] Attributes after migration: map[string]string{"attached_disk.#":"2", "attached_disk.0.disk_encryption_key_sha256":"", "attached_disk.1.disk_encryption_key_sha256":"", "boot_disk.#":"1", "attached_disk.0.disk_encryption_key_raw":"", "attached_disk.1.device_name":"persistent-disk-1", "attached_disk.1.disk_encryption_key_raw":"", "zone":"us-central1-f", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-0qnar4zb24-2", "attached_disk.0.device_name":"persistent-disk-2", "attached_disk.1.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-0qnar4zb24-1"} 2017/09/28 10:36:27 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:36:37 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:36:37 [TRACE] Waiting 2s before next try 2017/09/28 10:36:39 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:36:39 [TRACE] Waiting 4s before next try 2017/09/28 10:36:43 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:36:43 [TRACE] Waiting 8s before next try 2017/09/28 10:36:52 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:36:52 [TRACE] Waiting 10s before next try 2017/09/28 10:37:02 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:02 [TRACE] Waiting 10s before next try 2017/09/28 10:37:12 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:12 [TRACE] Waiting 10s before next try 2017/09/28 10:37:22 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:22 [TRACE] Waiting 10s before next try 2017/09/28 10:37:32 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:32 [TRACE] Waiting 10s before next try 2017/09/28 10:37:42 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:42 [TRACE] Waiting 10s before next try 2017/09/28 10:37:52 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:37:52 [TRACE] Waiting 10s before next try 2017/09/28 10:38:03 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:03 [TRACE] Waiting 10s before next try 2017/09/28 10:38:13 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:13 [TRACE] Waiting 10s before next try 2017/09/28 10:38:23 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:23 [TRACE] Waiting 10s before next try 2017/09/28 10:38:33 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:33 [TRACE] Waiting 10s before next try 2017/09/28 10:38:43 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:43 [TRACE] Waiting 10s before next try 2017/09/28 10:38:54 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:38:54 [TRACE] Waiting 10s before next try 2017/09/28 10:39:04 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" 2017/09/28 10:39:04 [TRACE] Waiting 10s before next try 2017/09/28 10:39:14 [DEBUG] Got "DONE" when asking for operation "operation-1506620186949-55a43590df589-017de9db-3dc91545" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromAutoDeleteAndImage (179.64s) === RUN TestAccComputeInstanceMigrateState_scratchDisk 2017/09/28 10:39:14 [INFO] Requesting Google token... 2017/09/28 10:39:14 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 10:39:14 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 10:39:14 [INFO] -- Private Key Length: 1704 2017/09/28 10:39:14 [INFO] Instantiating GCE client... 2017/09/28 10:39:14 [INFO] Instantiating GCE Beta client... 2017/09/28 10:39:14 [INFO] Instantiating GKE client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 10:39:14 [INFO] Instantiating Google Storage Client... 2017/09/28 10:39:14 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Pubsub Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 10:39:14 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 10:39:15 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:39:25 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620354656-55a43630cf702-026ed483-f6d4b02e" 2017/09/28 10:39:25 [TRACE] Waiting 2s before next try 2017/09/28 10:39:28 [DEBUG] Got "DONE" when asking for operation "operation-1506620354656-55a43630cf702-026ed483-f6d4b02e" 2017/09/28 10:39:28 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 10:39:28 [DEBUG] Attributes before migration: map[string]string{"boot_disk.#":"1", "disk.#":"1", "disk.0.auto_delete":"true", "disk.0.type":"local-ssd", "disk.0.scratch":"true", "zone":"us-central1-f"} 2017/09/28 10:39:28 [DEBUG] Attributes after migration: map[string]string{"zone":"us-central1-f", "scratch_disk.0.interface":"SCSI", "boot_disk.#":"1", "scratch_disk.#":"1"} 2017/09/28 10:39:29 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 10:39:39 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620368564-55a4363e12f20-6588e19b-65fd8514" 2017/09/28 10:39:39 [TRACE] Waiting 2s before next try 2017/09/28 10:39:41 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620368564-55a4363e12f20-6588e19b-65fd8514" 2017/09/28 10:39:41 [TRACE] Waiting 4s before next try 2017/09/28 10:39:45 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620368564-55a4363e12f20-6588e19b-65fd8514" 2017/09/28 10:39:45 [TRACE] Waiting 8s before next try 2017/09/28 10:39:53 [DEBUG] Got "RUNNING" when asking for operation "operation-1506620368564-55a4363e12f20-6588e19b-65fd8514" 2017/09/28 10:39:53 [TRACE] Waiting 10s before next try 2017/09/28 10:40:03 [DEBUG] Got "DONE" when asking for operation "operation-1506620368564-55a4363e12f20-6588e19b-65fd8514" --- PASS: TestAccComputeInstanceMigrateState_scratchDisk (49.44s) PASS ok github.com/terraform-providers/terraform-provider-google/google 448.269s |
Update the resolveImage call to include the new project parameter and fix the failing build, and I'll run the tests again quick and we can get this merged, finally, after much feet-dragging on my part. |
Done! |
Test output: ==> Checking that code complies with gofmt requirements... TF_ACC=1 go test ./google -v -run=TestAccComputeInstanceMigrateState -timeout 120m === RUN TestAccComputeInstanceMigrateState_bootDisk 2017/09/28 14:15:12 [INFO] Requesting Google token... 2017/09/28 14:15:12 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 14:15:12 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 14:15:12 [INFO] -- Private Key Length: 1704 2017/09/28 14:15:12 [INFO] Instantiating GCE client... 2017/09/28 14:15:12 [INFO] Instantiating GCE Beta client... 2017/09/28 14:15:12 [INFO] Instantiating GKE client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 14:15:12 [INFO] Instantiating Google Storage Client... 2017/09/28 14:15:12 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Pubsub Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 14:15:12 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 14:15:13 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:15:23 [DEBUG] Got "DONE" when asking for operation "operation-1506633312438-55a46676506f0-cf4ae33c-9e754194" 2017/09/28 14:15:23 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 14:15:23 [DEBUG] Attributes before migration: map[string]string{"disk.0.disk":"disk-1", "disk.0.type":"pd-ssd", "disk.0.device_name":"persistent-disk-0", "disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "disk.#":"1", "disk.0.auto_delete":"false", "disk.0.size":"12", "disk.0.disk_encryption_key_raw":"encrypt-key", "zone":"us-central1-f"} 2017/09/28 14:15:24 [DEBUG] Attributes after migration: map[string]string{"boot_disk.0.auto_delete":"false", "boot_disk.0.disk_encryption_key_raw":"encrypt-key", "zone":"us-central1-f", "boot_disk.0.source":"instance-test-anjcdw0xsi", "boot_disk.#":"1", "boot_disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "boot_disk.0.device_name":"persistent-disk-0"} 2017/09/28 14:15:24 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:15:34 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633324301-55a46681a0ac8-77f943bc-9cb7e802" 2017/09/28 14:15:34 [TRACE] Waiting 2s before next try 2017/09/28 14:15:37 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633324301-55a46681a0ac8-77f943bc-9cb7e802" 2017/09/28 14:15:37 [TRACE] Waiting 4s before next try 2017/09/28 14:15:41 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633324301-55a46681a0ac8-77f943bc-9cb7e802" 2017/09/28 14:15:41 [TRACE] Waiting 8s before next try 2017/09/28 14:15:49 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633324301-55a46681a0ac8-77f943bc-9cb7e802" 2017/09/28 14:15:49 [TRACE] Waiting 10s before next try 2017/09/28 14:15:59 [DEBUG] Got "DONE" when asking for operation "operation-1506633324301-55a46681a0ac8-77f943bc-9cb7e802" --- PASS: TestAccComputeInstanceMigrateState_bootDisk (47.49s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromSource 2017/09/28 14:15:59 [INFO] Requesting Google token... 2017/09/28 14:15:59 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 14:15:59 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 14:15:59 [INFO] -- Private Key Length: 1704 2017/09/28 14:15:59 [INFO] Instantiating GCE client... 2017/09/28 14:15:59 [INFO] Instantiating GCE Beta client... 2017/09/28 14:15:59 [INFO] Instantiating GKE client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 14:15:59 [INFO] Instantiating Google Storage Client... 2017/09/28 14:15:59 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Pubsub Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 14:15:59 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 14:16:00 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:16:10 [DEBUG] Got "DONE" when asking for operation "operation-1506633359706-55a466a364790-67d4c3c6-65f0ac02" 2017/09/28 14:16:11 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:16:22 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:22 [TRACE] Waiting 2s before next try 2017/09/28 14:16:24 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:24 [TRACE] Waiting 4s before next try 2017/09/28 14:16:28 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:28 [TRACE] Waiting 8s before next try 2017/09/28 14:16:36 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:36 [TRACE] Waiting 10s before next try 2017/09/28 14:16:46 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:46 [TRACE] Waiting 10s before next try 2017/09/28 14:16:56 [DEBUG] Got "DONE" when asking for operation "operation-1506633370695-55a466addf558-15b1b762-ac70f835" 2017/09/28 14:16:56 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 14:16:56 [DEBUG] Attributes before migration: map[string]string{"disk.0.disk_encryption_key_raw":"encrypt-key", "disk.0.disk_encryption_key_sha256":"encrypt-key-sha", "disk.0.disk":"instance-test-93upyaklg6", "zone":"us-central1-f", "boot_disk.#":"1", "disk.#":"1", "disk.0.device_name":"persistent-disk-1"} 2017/09/28 14:16:57 [DEBUG] Attributes after migration: map[string]string{"boot_disk.#":"1", "attached_disk.#":"1", "zone":"us-central1-f", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-93upyaklg6", "attached_disk.0.device_name":"persistent-disk-1", "attached_disk.0.disk_encryption_key_raw":"encrypt-key", "attached_disk.0.disk_encryption_key_sha256":"encrypt-key-sha"} 2017/09/28 14:16:57 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:17:08 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:08 [TRACE] Waiting 2s before next try 2017/09/28 14:17:10 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:10 [TRACE] Waiting 4s before next try 2017/09/28 14:17:14 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:14 [TRACE] Waiting 8s before next try 2017/09/28 14:17:22 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:22 [TRACE] Waiting 10s before next try 2017/09/28 14:17:32 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:32 [TRACE] Waiting 10s before next try 2017/09/28 14:17:42 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:42 [TRACE] Waiting 10s before next try 2017/09/28 14:17:53 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:17:53 [TRACE] Waiting 10s before next try 2017/09/28 14:18:03 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:03 [TRACE] Waiting 10s before next try 2017/09/28 14:18:13 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:13 [TRACE] Waiting 10s before next try 2017/09/28 14:18:23 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:23 [TRACE] Waiting 10s before next try 2017/09/28 14:18:33 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:33 [TRACE] Waiting 10s before next try 2017/09/28 14:18:43 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:43 [TRACE] Waiting 10s before next try 2017/09/28 14:18:54 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:18:54 [TRACE] Waiting 10s before next try 2017/09/28 14:19:04 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:19:04 [TRACE] Waiting 10s before next try 2017/09/28 14:19:14 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:19:14 [TRACE] Waiting 10s before next try 2017/09/28 14:19:24 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:19:24 [TRACE] Waiting 10s before next try 2017/09/28 14:19:34 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:19:34 [TRACE] Waiting 10s before next try 2017/09/28 14:19:45 [DEBUG] Got "DONE" when asking for operation "operation-1506633417351-55a466da5df59-60cc9837-2476b13b" 2017/09/28 14:19:45 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:19:55 [DEBUG] Got "DONE" when asking for operation "operation-1506633585051-55a4677a4c57b-d637c8b8-3be40435" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromSource (235.94s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromEncryptionKey 2017/09/28 14:19:55 [INFO] Requesting Google token... 2017/09/28 14:19:55 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 14:19:55 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 14:19:55 [INFO] -- Private Key Length: 1704 2017/09/28 14:19:55 [INFO] Instantiating GCE client... 2017/09/28 14:19:55 [INFO] Instantiating GCE Beta client... 2017/09/28 14:19:55 [INFO] Instantiating GKE client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 14:19:55 [INFO] Instantiating Google Storage Client... 2017/09/28 14:19:55 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Pubsub Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 14:19:55 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 14:19:57 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:20:07 [DEBUG] Got "DONE" when asking for operation "operation-1506633595712-55a4678477201-58d33b57-c9fc29df" 2017/09/28 14:20:07 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 14:20:07 [DEBUG] Attributes before migration: map[string]string{"boot_disk.#":"1", "disk.#":"1", "disk.0.image":"projects/debian-cloud/global/images/family/debian-8", "disk.0.disk_encryption_key_raw":"SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=", "disk.0.disk_encryption_key_sha256":"esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=", "zone":"us-central1-f"} 2017/09/28 14:20:07 [DEBUG] Attributes after migration: map[string]string{"attached_disk.0.disk_encryption_key_raw":"SGVsbG8gZnJvbSBHb29nbGUgQ2xvdWQgUGxhdGZvcm0=", "attached_disk.0.device_name":"persistent-disk-1", "attached_disk.#":"1", "zone":"us-central1-f", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-9t3gje7jcv-1", "attached_disk.0.disk_encryption_key_sha256":"esTuF7d4eatX4cnc4JsiEiaI+Rff78JgPhA/v1zxX9E=", "boot_disk.#":"1"} 2017/09/28 14:20:08 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:20:18 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633607761-55a4678ff4c68-ecf41e52-8e7d0b7e" 2017/09/28 14:20:18 [TRACE] Waiting 2s before next try 2017/09/28 14:20:20 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633607761-55a4678ff4c68-ecf41e52-8e7d0b7e" 2017/09/28 14:20:20 [TRACE] Waiting 4s before next try 2017/09/28 14:20:24 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633607761-55a4678ff4c68-ecf41e52-8e7d0b7e" 2017/09/28 14:20:24 [TRACE] Waiting 8s before next try 2017/09/28 14:20:32 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633607761-55a4678ff4c68-ecf41e52-8e7d0b7e" 2017/09/28 14:20:32 [TRACE] Waiting 10s before next try 2017/09/28 14:20:43 [DEBUG] Got "DONE" when asking for operation "operation-1506633607761-55a4678ff4c68-ecf41e52-8e7d0b7e" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromEncryptionKey (47.56s) === RUN TestAccComputeInstanceMigrateState_attachedDiskFromAutoDeleteAndImage 2017/09/28 14:20:43 [INFO] Requesting Google token... 2017/09/28 14:20:43 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 14:20:43 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 14:20:43 [INFO] -- Private Key Length: 1704 2017/09/28 14:20:43 [INFO] Instantiating GCE client... 2017/09/28 14:20:43 [INFO] Instantiating GCE Beta client... 2017/09/28 14:20:43 [INFO] Instantiating GKE client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 14:20:43 [INFO] Instantiating Google Storage Client... 2017/09/28 14:20:43 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Pubsub Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 14:20:43 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 14:20:44 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:20:54 [DEBUG] Got "DONE" when asking for operation "operation-1506633643187-55a467b1bdb39-f97bd7f2-1d12c964" 2017/09/28 14:20:54 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 14:20:54 [DEBUG] Attributes before migration: map[string]string{"zone":"us-central1-f", "boot_disk.#":"1", "disk.#":"2", "disk.0.image":"projects/debian-cloud/global/images/debian-8-jessie-v20170110", "disk.0.auto_delete":"true", "disk.1.image":"global/images/family/debian-8", "disk.1.auto_delete":"true"} 2017/09/28 14:20:55 [DEBUG] Attributes after migration: map[string]string{"attached_disk.1.disk_encryption_key_sha256":"", "boot_disk.#":"1", "attached_disk.0.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-oa4p1atcf0-2", "attached_disk.0.device_name":"persistent-disk-2", "attached_disk.1.device_name":"persistent-disk-1", "zone":"us-central1-f", "attached_disk.0.disk_encryption_key_raw":"", "attached_disk.1.source":"https://www.googleapis.com/compute/v1/projects/hc-terraform-testing/zones/us-central1-f/disks/instance-test-oa4p1atcf0-1", "attached_disk.1.disk_encryption_key_raw":"", "attached_disk.0.disk_encryption_key_sha256":"", "attached_disk.#":"2"} 2017/09/28 14:20:55 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:21:05 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:05 [TRACE] Waiting 2s before next try 2017/09/28 14:21:08 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:08 [TRACE] Waiting 4s before next try 2017/09/28 14:21:12 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:12 [TRACE] Waiting 8s before next try 2017/09/28 14:21:20 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:20 [TRACE] Waiting 10s before next try 2017/09/28 14:21:30 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:30 [TRACE] Waiting 10s before next try 2017/09/28 14:21:40 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:40 [TRACE] Waiting 10s before next try 2017/09/28 14:21:51 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:21:51 [TRACE] Waiting 10s before next try 2017/09/28 14:22:01 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:01 [TRACE] Waiting 10s before next try 2017/09/28 14:22:11 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:11 [TRACE] Waiting 10s before next try 2017/09/28 14:22:21 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:21 [TRACE] Waiting 10s before next try 2017/09/28 14:22:32 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:32 [TRACE] Waiting 10s before next try 2017/09/28 14:22:42 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:42 [TRACE] Waiting 10s before next try 2017/09/28 14:22:52 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:22:52 [TRACE] Waiting 10s before next try 2017/09/28 14:23:02 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:23:02 [TRACE] Waiting 10s before next try 2017/09/28 14:23:12 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:23:12 [TRACE] Waiting 10s before next try 2017/09/28 14:23:22 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:23:22 [TRACE] Waiting 10s before next try 2017/09/28 14:23:33 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" 2017/09/28 14:23:33 [TRACE] Waiting 10s before next try 2017/09/28 14:23:43 [DEBUG] Got "DONE" when asking for operation "operation-1506633655197-55a467bd31d49-747d0e08-138c4179" --- PASS: TestAccComputeInstanceMigrateState_attachedDiskFromAutoDeleteAndImage (180.18s) === RUN TestAccComputeInstanceMigrateState_scratchDisk 2017/09/28 14:23:43 [INFO] Requesting Google token... 2017/09/28 14:23:43 [INFO] -- Email: terraform-acceptance-tests@hc-terraform-testing.iam.gserviceaccount.com 2017/09/28 14:23:43 [INFO] -- Scopes: [https://www.googleapis.com/auth/compute https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/ndev.clouddns.readwrite https://www.googleapis.com/auth/devstorage.full_control] 2017/09/28 14:23:43 [INFO] -- Private Key Length: 1704 2017/09/28 14:23:43 [INFO] Instantiating GCE client... 2017/09/28 14:23:43 [INFO] Instantiating GCE Beta client... 2017/09/28 14:23:43 [INFO] Instantiating GKE client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud DNS client... 2017/09/28 14:23:43 [INFO] Instantiating Google Storage Client... 2017/09/28 14:23:43 [INFO] Instantiating Google SqlAdmin Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Pubsub Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud ResourceManager Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud Runtimeconfig Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud IAM Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud Service Management Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud Billing Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud BigQuery Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud Source Repo Client... 2017/09/28 14:23:43 [INFO] Instantiating Google Cloud Spanner Client... 2017/09/28 14:23:44 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:23:54 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633823472-55a4685dac981-ffe1cada-0e33d4a8" 2017/09/28 14:23:54 [TRACE] Waiting 2s before next try 2017/09/28 14:23:56 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633823472-55a4685dac981-ffe1cada-0e33d4a8" 2017/09/28 14:23:56 [TRACE] Waiting 4s before next try 2017/09/28 14:24:01 [DEBUG] Got "DONE" when asking for operation "operation-1506633823472-55a4685dac981-ffe1cada-0e33d4a8" 2017/09/28 14:24:01 [INFO] Found Compute Instance State v3; migrating to v4 2017/09/28 14:24:01 [DEBUG] Attributes before migration: map[string]string{"disk.#":"1", "disk.0.auto_delete":"true", "disk.0.type":"local-ssd", "disk.0.scratch":"true", "zone":"us-central1-f", "boot_disk.#":"1"} 2017/09/28 14:24:01 [DEBUG] Attributes after migration: map[string]string{"zone":"us-central1-f", "scratch_disk.0.interface":"SCSI", "boot_disk.#":"1", "scratch_disk.#":"1"} 2017/09/28 14:24:02 [DEBUG] Waiting for state to become: [DONE] 2017/09/28 14:24:12 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633841555-55a4686eeb63a-554b760c-2fe4e15f" 2017/09/28 14:24:12 [TRACE] Waiting 2s before next try 2017/09/28 14:24:14 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633841555-55a4686eeb63a-554b760c-2fe4e15f" 2017/09/28 14:24:14 [TRACE] Waiting 4s before next try 2017/09/28 14:24:18 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633841555-55a4686eeb63a-554b760c-2fe4e15f" 2017/09/28 14:24:18 [TRACE] Waiting 8s before next try 2017/09/28 14:24:26 [DEBUG] Got "RUNNING" when asking for operation "operation-1506633841555-55a4686eeb63a-554b760c-2fe4e15f" 2017/09/28 14:24:26 [TRACE] Waiting 10s before next try 2017/09/28 14:24:36 [DEBUG] Got "DONE" when asking for operation "operation-1506633841555-55a4686eeb63a-554b760c-2fe4e15f" --- PASS: TestAccComputeInstanceMigrateState_scratchDisk (53.63s) PASS ok github.com/terraform-providers/terraform-provider-google/google 564.804s |
Still LGTM, merge at will. |
@danawillow seems like this PR doesn't cover the case where the disk section is defined as follow:
When I used the last version of the provider, I had to adjust my terraform module to exchange the
Now, when I run
Any idea how to work around this ? |
I worked around it with this change :
Not sure if this change covers all use cases, but at least to migrated my state files to the desired state. |
I believe if you change the |
@paddycarver you are right, but this requires that I create the root disk of the instances separately (then use it in source). Using source is not a good option as it will require lots of changes in our code (check the terraform code block I posted before which is a small part of a module we use). |
Paddy is right. It doesn't actually require creating the root disk separately, since all you're trying to do right now is avoid creating a new resource. Yes you'll have to change your config, but since Unfortunately that diff won't necessarily work for all cases because the boot disk isn't necessarily at index 0 in everyone's config. |
@danawillow thanks for your response. Anyway, I have already migrated our statefiles using the diff I posted before. The good news for us is that we didn't have to change any terraform file. And yes, I am aware that the diff won't work in all case. I just shared for people how have similar case like ours :) |
Great, glad you got it working! |
…sk (hashicorp#329) * Add state migration from disk to boot_disk/scratch_disk/attached_disk * get rid of test for now * update schema version * add tests for migration * fix travis errors * actually fix travis errors * fix logic when project is set, also remove some log statements * add tests for reading based on encryption key and image * use as much of the image URL as we can for matching on image * read project from config if it wasn't set in the attribute * update resolveImage call
…sk (hashicorp#329) * Add state migration from disk to boot_disk/scratch_disk/attached_disk * get rid of test for now * update schema version * add tests for migration * fix travis errors * actually fix travis errors * fix logic when project is set, also remove some log statements * add tests for reading based on encryption key and image * use as much of the image URL as we can for matching on image * read project from config if it wasn't set in the attribute * update resolveImage call
<!-- This change is generated by MagicModules. --> /cc @chrisst
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Fixes #314. That issue claims it needs to be done in several steps, but I think I found a way to do it in just one.
Note that this is based off of #327 (and thus contains all of it here) so that one should be reviewed first.
I'm not sure the best way to test this inside of
resource_compute_instance_migrate_test
since it'll be making actual API calls. If you know offhand of an example where another resource does something similar I'd love to see it.In the meantime, here's the test config I used to check it on my end:
And here's the output from the logs: