Skip to content
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

Errors when building Google Compute Instance from snapshot #3557

Closed
ghost opened this issue May 6, 2019 · 4 comments · Fixed by GoogleCloudPlatform/magic-modules#1743
Closed
Assignees

Comments

@ghost
Copy link

ghost commented May 6, 2019

This issue was originally opened by @antman1p as hashicorp/terraform#21215. It was migrated here as a result of the provider split. The original body of the issue is below.


Terraform Version

Terraform v0.11.13

Terraform Configuration Files

resource "google_compute_instance" "https-c2" {
  count = "${var.count}"
  machine_type = "${var.machine_type}"
  name = "https-c2-${random_id.server.*.hex[count.index]}"
  zone = "${var.available_zones[element(var.zones, count.index)]}"
  can_ip_forward = true  
  
  tags = ["servers"]

  boot_disk {
    source = "projects/testproject-123456/global/snapshots/my-snapshot"
  }

Debug Output

https://gist.github.com/antman1p/59831a0e92c043d7e46b2b2a92171b33

Crash Output

NONE

Expected Behavior

GCP instances should have been built from the specified snapshot

Actual Behavior

It appears that Terraform replaced "/global/snapshots/" with "/zones/us-east4-a/"

Steps to Reproduce

  1. terraform init
  2. terraform plan
  3. terraform apply

Additional Context

Using the RedBaron templates: https://github.com/Coalfire-Research/Red-Baron

References

No
@antman1p
Copy link

antman1p commented May 6, 2019

That should say: "It appears that Terraform replaced '/global/snapshots/" with "/zones/us-east4-a/disks/'"

@antman1p
Copy link

antman1p commented May 7, 2019

I figured out how to build from images and disks. I am assuming building from snapshots would be a new feature with Terraform?

@chrisst chrisst self-assigned this May 8, 2019
@chrisst
Copy link
Contributor

chrisst commented May 8, 2019

Creating a compute instance with a disk from an image or adding a boot disk is able to be done in a single call to the compute instance API. However even though it looks the same in the cloud console to build from a snapshot it's actually making multiple calls in the back end to create a disk from snapshot, then passing that disk into the create call for the compute instance. If you look at the "equivalent REST or command line" when in the UI you will see the 2 API calls or 2 gcloud calls.

I will clarify this in the docs, but for now you should be able to create a compute_disk from a snapshot and then reference that disk in the boot_disk source.

@ghost
Copy link
Author

ghost commented Jun 9, 2019

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants