https://pulumi.com logo
Title
q

quiet-laptop-13439

06/27/2022, 2:22 PM
We are getting
Target 'urn:XXX' could not be found in the stack
error when trying to apply resource. However, we can see the resource with the urn both in the state and AWS console. What could that mean and what could be the fix?
b

billowy-army-68599

06/27/2022, 2:27 PM
are you on the right stack?
q

quiet-laptop-13439

06/27/2022, 2:58 PM
yes i am
it also shows resource to be deleted in the plan
b

billowy-army-68599

06/27/2022, 3:00 PM
Can you share the diff?
q

quiet-laptop-13439

06/27/2022, 3:05 PM
Previewing update (single-region-test):
     Type                              Name                                    Plan       Info
     pulumi:pulumi:Stack               single-region-stack-single-region-test             3 errors
 -   ├─ aws:ec2:RouteTableAssociation  eu-west-1c-public                       delete     
 -   ├─ aws:ec2:Route                  eu-west-1c-public                       delete     
 -   └─ aws:ec2:Subnet                 eu-west-1c-public                       delete     
 
Diagnostics:
  pulumi:pulumi:Stack (single-region-stack-single-region-test):
    error: Target 'urn:pulumi:single-region-test::single-region-stack::dycloud:index:Ec2Vpc$dycloud:index:Subnet$aws:ec2/routeTableAssociation:RouteTableAssociation' could not be found in the stack.
    error: Target 'urn:pulumi:single-region-test::single-region-stack::dycloud:index:Ec2Vpc$dycloud:index:Subnet$aws:ec2/subnet:Subnet::eu-west-1c-public' could not be found in the stack.
    error: Target 'urn:pulumi:single-region-test::single-region-stack::dycloud:index:Ec2Vpc$dycloud:index:Subnet$aws:ec2/route:Route::eu-west-1c-public' could not be found in the stack.
b

billowy-army-68599

06/27/2022, 3:08 PM
Can you run pulumi refresh ?
q

quiet-laptop-13439

06/27/2022, 3:21 PM
didn't fix it
b

billowy-army-68599

06/27/2022, 3:32 PM
I've honestly never seen this error, very surprised the stack is in this state: • can you share the code you're using to define your program • can you shack the output of
pulumi stack export
(in a github gist if it's long)
q

quiet-laptop-13439

06/29/2022, 1:38 PM
it looks like this is caused if you run pulumi up targeting a custom resource and it has other resources nested under it
then it loses references somehow
we can't publish state, sorry 🙂