-
Notifications
You must be signed in to change notification settings - Fork 3
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
Imported BootVolume's sourceDetails
is null causing unwanted replace
#714
Comments
@JakubKoralewski thanks for reporting this issue. It looks like this is probably an issue with the upstream provider as well. If you could try to reproduce this in Terraform that would help us know for sure. My hunch is that this is caused by the Terraform importer being best effort. I am assuming that the The workaround that you mentioned where you edit the state is a good workaround for this. |
I don't know terraform that well, but it looks to me like the same exact issue: The output of Full logs here: jakubkoralewski@Er codeserver-2-tf-gh-repro % terraform import oci_core_boot_volume.code_server_boot_volume ocid1.bootvolume.oc1.eu-amsterdam-1.id
oci_core_boot_volume.code_server_boot_volume: Importing from ID "ocid1.bootvolume.oc1.eu-amsterdam-1.id"...
oci_core_boot_volume.code_server_boot_volume: Import prepared!
Prepared oci_core_boot_volume for import
oci_core_boot_volume.code_server_boot_volume: Refreshing state... [id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
jakubkoralewski@Er codeserver-2-tf-gh-repro % terraform plan
oci_core_boot_volume.code_server_boot_volume: Refreshing state... [id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
Terraform used the selected providers to generate the following execution plan.
Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement
Terraform will perform the following actions:
# oci_core_boot_volume.code_server_boot_volume must be replaced
-/+ resource "oci_core_boot_volume" "code_server_boot_volume" {
~ auto_tuned_vpus_per_gb = "10" -> (known after apply)
+ backup_policy_id = (known after apply)
+ cluster_placement_group_id = (known after apply)
~ freeform_tags = {} -> (known after apply)
~ id = "ocid1.bootvolume.oc1.eu-amsterdam-1.id" -> (known after apply)
~ image_id = "ocid1.image.oc1.eu-amsterdam-1.id" -> (known after apply)
~ is_auto_tune_enabled = true -> (known after apply)
~ is_hydrated = true -> (known after apply)
+ kms_key_id = (known after apply)
~ size_in_mbs = "51200" -> (known after apply)
~ state = "AVAILABLE" -> (known after apply)
~ system_tags = {
- "orcl-cloud.free-tier-retained" = "true"
} -> (known after apply)
~ time_created = "2021-12-14 18:45:30.188 +0000 UTC" -> (known after apply)
+ volume_group_id = (known after apply)
+ xrc_kms_key_id = (known after apply)
# (6 unchanged attributes hidden)
~ autotune_policies {
+ max_vpus_per_gb = (known after apply)
# (1 unchanged attribute hidden)
}
~ boot_volume_replicas (known after apply)
+ source_details { # forces replacement
+ type = "bootVolume" # forces replacement
}
}
Plan: 1 to add, 0 to change, 1 to destroy.
──────────────────────────────────────────────────────────────────────────────────
Note: You didn't use the -out option to save this plan, so Terraform can't
guarantee to take exactly these actions if you run "terraform apply" now.
main.tf resource "oci_core_boot_volume" "code_server_boot_volume" {
availability_domain = "fkYL:eu-amsterdam-1-AD-1"
compartment_id = "ocid1.tenancy.oc1..id"
defined_tags = {
"Oracle-Tags.CreatedBy" = "oracleidentitycloudservice/[email protected]"
"Oracle-Tags.CreatedOn" = "2021-12-14T18:45:26.894Z"
}
display_name = "code-server (Boot Volume)"
freeform_tags = {}
size_in_gbs = "50"
vpus_per_gb = "10"
source_details {
type = "bootVolume"
}
autotune_policies {
autotune_type = "DETACHED_VOLUME"
max_vpus_per_gb = null
}
} |
Describe what happened
I import an existing
BootVolume
into Pulumi, I don't (want to) change anything on the boot volume, just import as-is, but when I runpulumi up
it wants to replace my boot volume. I think that's a bug as it will delete my data.I import a boot volume:
After importing a boot volume I get this message (full logs of
pulumi import
in logs section):You can see the imported
sourceDetails
is malformed:And the pulumi code it tells me to use has malformed types:
I get an error that type needs to be either of
bootVolume
,bootVolumeBackup
, etc.Now when I do
pulumi up
I get this error (due to thesourceDetails
issues above):I tried setting it to a
bootVolume
since that's what it is:Then
pulumi up
wants to replace my volume:If I remove the
{protect:true}
the details gives me this output:I don't understand this output tbh.
Sample program
It's auto-generated after the
pulumi import
but here you go:Log output
Full output of
pulumi import
:Affected Resource(s)
BootVolume
Output of
pulumi about
Additional context
In the meantime, should I edit the stack state manually somehow?
EDIT: Yes, added {"type": "bootVolume"} to both "inputs" and "outputs" in the state entry of the boot volume, now it doesn't want to replace anymore
Contributing
Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).
The text was updated successfully, but these errors were encountered: