https://pulumi.com logo
#aws
Title
# aws
w

worried-queen-62794

05/03/2021, 12:56 AM
Am I correct in interpreting from this issue https://github.com/pulumi/pulumi/issues/6547 that it is not possible to import a volume?
I'm sure I have done it in the past but I can't seem to get it to work now.
l

little-cartoon-10569

05/03/2021, 1:23 AM
If you import the volume, then edit the generated code before running
up
or
preview
, will it work?
The OP on that issue implies it will work, in this other issue: https://github.com/pulumi/pulumi/issues/6541#issuecomment-800690412
w

worried-queen-62794

05/03/2021, 1:55 AM
Damn it... I tried that, and it worked without the size or snapshot id somehow but now refresh fails with:
Copy code
error: unexpected duplicate resource 'urn:pulumi:prod::tlayen::pulumi:providers:aws::default'
I exported the state again and did a diff and there are no other changes.
The default provider doesn't seem to be duplicated. How would that even be possible?
At least if I remove them and import again then refresh works.
l

little-cartoon-10569

05/03/2021, 2:00 AM
Hmm.. maybe the default provider changed? I'm always wary of the default provider, I find it changes at the most inconvenient times...
w

worried-queen-62794

05/03/2021, 2:02 AM
As far as I know I'm not using the default anywhere. It is in my state when I export it though.
l

little-cartoon-10569

05/03/2021, 2:02 AM
The imported resource will be using the default, unless you've edited the code...
w

worried-queen-62794

05/03/2021, 2:10 AM
I forgot the provider at first but the second time I added it the JSON but I still get the same problem. I don't actually know what the JSON should look like.
or did I... seems to work now. Not sure if it is because I missed a provider somewhere or have the
inputs
correctly specified now.
l

little-cartoon-10569

05/03/2021, 2:15 AM
Yep, seems like the import JSON causes a lot of problems. I haven't used it yet, I've only imported individual resources and skipped the json step...
w

worried-queen-62794

05/03/2021, 2:23 AM
I'll chalk that up to user error with advanced feature. Thanks anyway simple smile
b

broad-hairdresser-1495

05/04/2021, 8:35 AM
Hi @worried-queen-62794 could you share how you do import volume? I have similar issue where volume import does not work.
w

worried-queen-62794

05/04/2021, 8:44 PM
Hi @broad-hairdresser-1495. It's tricky. You have to do
pulumi stack export
, then add something like:
Copy code
{
                "urn": "urn:pulumi:test::mystack::aws:ebs/volume:Volume::MyVolume",
                "custom": true,
                "id": "vol-abc123",
                "type": "aws:ebs/volume:Volume",
                "inputs": {
                    "__defaults": [],
                    "availabilityZone": "ap-southeast-2a",
                    "size": 5,
                    "tags": {
                        "Name": "MyVolume",
                        "__defaults": []
                    },
                    "type": "gp2"
                },
             }
then
pulumi stack import
b

broad-hairdresser-1495

06/04/2021, 11:19 AM
Copy code
bkp = aws.ebs.Volume('msops-test-volume-bkp',
    availability_zone='eu-north-1a',
    size=500,
    opts=ResourceOptions(import_='vol-080446c9.........'))
this is also possible to import volume, but you need to include size.
2 Views