-
Notifications
You must be signed in to change notification settings - Fork 2
Description
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 run pulumi 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:
pulumi import oci:Core/bootVolume:BootVolume code-server-boot-volume ocid1.bootvolume.oc1.eu-amsterdam-1.idAfter importing a boot volume I get this message (full logs of pulumi import in logs section):
Diagnostics:
oci:Core:BootVolume (code-server-boot-volume):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `oci` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: oci:Core/bootVolume:BootVolume resource 'code-server-boot-volume' has a problem: Missing required argument. The argument "source_details" is required, but no definition was found.. Examine values at 'code-server-boot-volume.sourceDetails'.You can see the imported sourceDetails is malformed:
sourceDetails : <null>And the pulumi code it tells me to use has malformed types:
sourceDetails: {
type: "",
},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 the sourceDetails issues above):
jakubkoralewski@Er codeserver-2 % pulumi up -s bug-repro
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
Previewing update (bug-repro):
Type Name Plan Info
pulumi:pulumi:Stack codeserver-2-bug-repro
└─ oci:Core:BootVolume code-server-boot-volume 1 error
Diagnostics:
oci:Core:BootVolume (code-server-boot-volume):
error: oci:Core/bootVolume:BootVolume resource 'code-server-boot-volume' has a problem: expected source_details.0.type to be one of ["bootVolume" "bootVolumeBackup" "bootVolumeBackupDelta" "bootVolumeReplica"], got . Examine values at 'code-server-boot-volume.sourceDetails.type'.I tried setting it to a bootVolume since that's what it is:
sourceDetails: {
type: "bootVolume",
},Then pulumi up wants to replace my volume:
jakubkoralewski@Er codeserver-2 % pulumi up -s bug-repro
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
Previewing update (bug-repro):
Type Name Plan Info
pulumi:pulumi:Stack codeserver-2-bug-repro 1 error
+- └─ oci:Core:BootVolume code-server-boot-volume replace [diff: +sourceDeta
Diagnostics:
pulumi:pulumi:Stack (codeserver-2-bug-repro):
error: preview failed
oci:Core:BootVolume (code-server-boot-volume):
error: unable to replace resource "urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume"
as it is currently marked for protection. To unprotect the resource, remove the `protect` flag from the resource in your Pulumi program and run `pulumi up`If I remove the {protect:true} the details gives me this output:
jakubkoralewski@Er codeserver-2 % pulumi up -s bug-repro
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
Previewing update (bug-repro):
Type Name Plan Info
pulumi:pulumi:Stack codeserver-2-bug-repro
+- └─ oci:Core:BootVolume code-server-boot-volume replace [diff: +sourceDetails~sourceDetails]
Resources:
+-1 to replace
1 unchanged
Do you want to perform this update? details
pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:bug-repro::codeserver-2::pulumi:pulumi:Stack::codeserver-2-bug-repro]
++oci:Core/bootVolume:BootVolume: (create-replacement) 🔓
[id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
[urn=urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume]
[provider=urn:pulumi:bug-repro::codeserver-2::pulumi:providers:oci::default_2_23_0::151d1dd8-46f3-4fdb-9ec2-19cda3f713bd]
+ sourceDetails: {
+ type : "bootVolume"
}
+ sourceDetails: {
+ type : "bootVolume"
}
+-oci:Core/bootVolume:BootVolume: (replace) 🔓
[id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
[urn=urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume]
[provider=urn:pulumi:bug-repro::codeserver-2::pulumi:providers:oci::default_2_23_0::151d1dd8-46f3-4fdb-9ec2-19cda3f713bd]
+ sourceDetails: {
+ type : "bootVolume"
}
+ sourceDetails: {
+ type : "bootVolume"
}
--oci:Core/bootVolume:BootVolume: (delete-replaced) 🔒
[id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
[urn=urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume]
[provider=urn:pulumi:bug-repro::codeserver-2::pulumi:providers:oci::default_2_23_0::151d1dd8-46f3-4fdb-9ec2-19cda3f713bd]
Do you want to perform this update? [Use arrows to move, type to filter]
yes
> no
details
I don't understand this output tbh.
Sample program
It's auto-generated after the pulumi import but here you go:
import * as oci from "@pulumi/oci";
export = async () => {
const code_server_boot_volume = new oci.core.BootVolume("code-server-boot-volume", {
autotunePolicies: [{
autotuneType: "DETACHED_VOLUME",
}],
availabilityDomain: "fkYL:eu-amsterdam-1-AD-1",
compartmentId: "ocid1.tenancy.oc1..id",
definedTags: {
"Oracle-Tags.CreatedBy": "oracleidentitycloudservice/[email protected]",
"Oracle-Tags.CreatedOn": "2021-12-14T18:45:26.894Z",
},
displayName: "code-server (Boot Volume)",
isAutoTuneEnabled: true,
sizeInGbs: "50",
sourceDetails: {
type: "",
},
vpusPerGb: "10",
}, {protect:true});
}Log output
Full output of pulumi import:
jakubkoralewski@Er codeserver-2 % pulumi import oci:Core/bootVolume:BootVolume code-server-boot-volume ocid1.bootvolume.oc1.eu-amsterdam-1.abqw2ljr2o4x47mzmdhcqzkejsifmk4v3qqim3pnaz53k3i5mhetg55clxla
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
Previewing import (bug-repro):
Type Name Plan Info
+ pulumi:pulumi:Stack codeserver-2-bug-repro create
= └─ oci:Core:BootVolume code-server-boot-volume import 2 warnings
Diagnostics:
oci:Core:BootVolume (code-server-boot-volume):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `oci` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: oci:Core/bootVolume:BootVolume resource 'code-server-boot-volume' has a problem: Missing required argument. The argument "source_details" is required, but no definition was found.. Examine values at 'code-server-boot-volume.sourceDetails'.
Resources:
+ 1 to create
= 1 to import
2 changes
Do you want to perform this import? details
+ pulumi:pulumi:Stack: (create)
[urn=urn:pulumi:bug-repro::codeserver-2::pulumi:pulumi:Stack::codeserver-2-bug-repro]
= oci:Core/bootVolume:BootVolume: (import) 🔒
[id=ocid1.bootvolume.oc1.eu-amsterdam-1.id]
[urn=urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume]
[provider=urn:pulumi:bug-repro::codeserver-2::pulumi:providers:oci::default_2_23_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
autotunePolicies : [
[0]: {
autotuneType: "DETACHED_VOLUME"
}
]
availabilityDomain: "fkYL:eu-amsterdam-1-AD-1"
compartmentId : "ocid1.tenancy.oc1..id"
definedTags : {
Oracle-Tags.CreatedBy: "oracleidentitycloudservice/[email protected]"
Oracle-Tags.CreatedOn: "2021-12-14T18:45:26.894Z"
}
displayName : "code-server (Boot Volume)"
isAutoTuneEnabled : true
sizeInGbs : "50"
sourceDetails : <null>
vpusPerGb : "10"
Do you want to perform this import? yes
Importing (bug-repro):
Type Name Status Info
+ pulumi:pulumi:Stack codeserver-2-bug-repro created
= └─ oci:Core:BootVolume code-server-boot-volume imported (0.42s) 2 warning
Diagnostics:
oci:Core:BootVolume (code-server-boot-volume):
warning: One or more imported inputs failed to validate. This is almost certainly a bug in the `oci` provider. The import will still proceed, but you will need to edit the generated code after copying it into your program.
warning: oci:Core/bootVolume:BootVolume resource 'code-server-boot-volume' has a problem: Missing required argument. The argument "source_details" is required, but no definition was found.. Examine values at 'code-server-boot-volume.sourceDetails'.
Resources:
+ 1 created
= 1 imported
2 changes
Duration: 2s
Please copy the following code into your Pulumi application. Not doing so
will cause Pulumi to report that an update will happen on the next update command.
Please note that the imported resources are marked as protected. To destroy them
you will need to remove the `protect` option and run `pulumi update` *before*
the destroy will take effect.
import * as pulumi from "@pulumi/pulumi";
import * as oci from "@pulumi/oci";
const code_server_boot_volume = new oci.core.BootVolume("code-server-boot-volume", {
autotunePolicies: [{
autotuneType: "DETACHED_VOLUME",
}],
availabilityDomain: "fkYL:eu-amsterdam-1-AD-1",
compartmentId: "ocid1.tenancy.oc1..id",
definedTags: {
"Oracle-Tags.CreatedBy": "oracleidentitycloudservice/[email protected]",
"Oracle-Tags.CreatedOn": "2021-12-14T18:45:26.894Z",
},
displayName: "code-server (Boot Volume)",
isAutoTuneEnabled: true,
sizeInGbs: "50",
sourceDetails: {
type: "",
},
vpusPerGb: "10",
}, {
protect: true,
});
Affected Resource(s)
BootVolume
Output of pulumi about
jakubkoralewski@Er codeserver-2 % pulumi about
Enter your passphrase to unlock config/secrets
(set PULUMI_CONFIG_PASSPHRASE or PULUMI_CONFIG_PASSPHRASE_FILE to remember):
Enter your passphrase to unlock config/secrets
CLI
Version 3.136.1
Go Version go1.23.2
Go Compiler gc
Plugins
KIND NAME VERSION
language nodejs unknown
resource oci 2.23.0
Host
OS darwin
Version 14.5
Arch arm64
This project is written in nodejs: executable='/usr/local/bin/node' version='v19.6.1'
Current Stack: organization/codeserver-2/bug-repro
TYPE URN
pulumi:pulumi:Stack urn:pulumi:bug-repro::codeserver-2::pulumi:pulumi:Stack::codeserver-2-bug-repro
pulumi:providers:oci urn:pulumi:bug-repro::codeserver-2::pulumi:providers:oci::default_2_23_0
oci:Core/bootVolume:BootVolume urn:pulumi:bug-repro::codeserver-2::oci:Core/bootVolume:BootVolume::code-server-boot-volume
Found no pending operations associated with bug-repro
Backend
Name Er.local
URL file://./stack
User jakubkoralewski
Organizations
Token type personal
Pulumi locates its logs in /var/folders/7f/rdn7ymps56576nz1c2cn1bth0000gn/T/ by default
warning: Failed to get information about the Pulumi program's dependencies: no package-lock.json or yarn.lock file found (searching upwards from /Users/jakubkoralewski/Projects/codeserver-2)
jakubkoralewski@Er codeserver-2 %
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).