-
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
Support import in compute instance #873
Conversation
--- 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()) |
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 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?
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 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. |
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.
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.
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. Will do
…shicorp#873) Signed-off-by: Modular Magician <[email protected]>
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 #369