https://pulumi.com logo
#general
Title
# general
c

chilly-tailor-89151

06/01/2023, 12:44 PM
Hi everyone, I am trying to delete the default VPC using Sdk I see that code
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

// Delete the default VPC
const defaultVpc = new aws.ec2.DefaultVpc("defaultVpc", {
  forceDestroy: true,
});
and run
pulumi up
, the result is nothing happen. try to run
pulumi destroy
throw and error dependencies what I do wrong please?
f

flaky-finland-22550

06/01/2023, 1:38 PM
I think you do not have that resource in your stack so what you can do is to import it into your stack first before you run the up or destroy command.
c

chilly-tailor-89151

06/01/2023, 1:40 PM
@flaky-finland-22550 thanks but on previwe I see the stack
f

flaky-finland-22550

06/01/2023, 1:42 PM
From the code you have provided, you are creating an aws.ec2.DefaultVpc.
c

chilly-tailor-89151

06/01/2023, 1:45 PM
is from Pulumi AI, every account by default has default VPC with dependencies inside (subnets) and I wanna to delete the defaults. the code you see is the answer of the Pulumi AI
f

flaky-finland-22550

06/01/2023, 1:52 PM
Okay please. Which error do you get when you run the destroy command?
c

chilly-tailor-89151

06/01/2023, 1:55 PM
DependencyViolation: The vpc ’ has dependencies and cannot be deleted.
@flaky-finland-22550 also in
Pulumi Ai
, tell you when you being and forceDestroy equal to true should deleted by
pulumi up
4 Views