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

Support import in compute instance #873

Merged
merged 3 commits into from
Dec 19, 2017
Merged

Conversation

rosbo
Copy link
Contributor

@rosbo rosbo commented Dec 18, 2017

Fixes #369

@rosbo
Copy link
Contributor Author

rosbo commented Dec 18, 2017

--- PASS: TestAccComputeInstance_basic1 (37.60s)
--- PASS: TestAccComputeInstance_service_account (47.98s)
--- PASS: TestAccComputeInstance_forceChangeMachineTypeManually (68.64s)
--- PASS: TestAccComputeInstance_subnet_custom (105.19s)
--- PASS: TestAccComputeInstance_update (90.18s)
--- PASS: TestAccComputeInstance_attachedDisk_sourceUrl (134.14s)
--- PASS: TestAccComputeInstance_bootDisk_sourceUrl (59.01s)
--- PASS: TestAccComputeInstance_bootDisk_source (65.43s)
--- PASS: TestAccComputeInstance_scratchDisk (179.36s)
--- PASS: TestAccComputeInstance_bootDisk_type (179.27s)
--- PASS: TestAccComputeInstance_forceNewAndChangeMetadata (238.79s)
--- PASS: TestAccComputeInstance_minCpuPlatform (50.30s)
--- PASS: TestAccComputeInstance_primaryAliasIpRange (48.17s)
--- PASS: TestAccComputeInstance_attachedDiskUpdate (146.96s)
--- PASS: TestAccComputeInstance_scheduling (47.83s)
--- PASS: TestAccComputeInstance_private_image_family (140.50s)
--- PASS: TestAccComputeInstance_subnet_auto (392.87s)
--- PASS: TestAccComputeInstance_secondaryAliasIpRange (397.77s)
--- PASS: TestAccComputeInstance_guestAccelerator (72.86s)
--- PASS: TestAccComputeInstance_address_custom (416.07s)
--- PASS: TestAccComputeInstance_attachedDisk (69.49s)
--- PASS: TestAccComputeInstance_basic4 (49.97s)
--- PASS: TestAccComputeInstance_basic5 (193.23s)
--- PASS: TestAccComputeInstance_basic3 (223.52s)
--- PASS: TestAccComputeInstance_diskEncryption (245.84s)
--- PASS: TestAccComputeInstance_IP (246.31s)
--- PASS: TestAccComputeInstance_basic2 (213.91s)
--- PASS: TestAccComputeInstance_address_auto (428.32s)
--- PASS: TestAccComputeInstance_multiNic (424.17s)
--- PASS: TestAccComputeInstance_GenerateIP (48.52s)

parts := strings.Split(d.Id(), "/")

if len(parts) != 3 {
return nil, fmt.Errorf("Invalid import id %q. Expecting {project}/{zone}/{instance_name}", d.Id())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it would be worth it to also allow users to just import by name and then rely on the provider-level project/zone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will refactor what we have done in some other resources to make it reusable and reuse it here. I wanted to keep that PR simple.


## Import

~> **Note:** The fields `boot_disk.0.initialize_params`, `boot_disk.0.disk_entryption_raw` and `attached_disk.*.disk_encryption_key_raw` cannot be imported automatically. The API doesn't return this information. You will need to update your state manually for this field after importing the resource.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make it extra clear, I'd say something like "If you are setting one of these fields in your config, you will need to update your state..." since not everybody is going to need to update their state.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Will do

@rosbo rosbo merged commit c1d9bb2 into hashicorp:master Dec 19, 2017
@rosbo rosbo deleted the import-instance branch December 19, 2017 22:33
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
…shicorp#873)

Signed-off-by: Modular Magician <magic-modules@google.com>
@ghost
Copy link

ghost commented Mar 30, 2020

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 Mar 30, 2020
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 this pull request may close these issues.

Support google_compute_instance import
2 participants