Just started getting this error: ```error: could n...
# general
g
Just started getting this error:
Copy code
error: could not deserialize deployment: snapshot integrity failure; refusing to use it: resource urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:route53/record:Record::r53-resource-name dependency urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:lb/loadBalancer:LoadBalancer::lb-name refers to missing resource
I cannot simply
rm
my stack as it's in use (and has been from some time). Importing the resource that is claimed to be missing is also failing. (also posted this msg in #typescript)
i
you'll need to export state an examine the error
Copy code
pulumi stack export --stack foo > state.json
g
Thanks, @icy-controller-6092 for the response. So, ran that and the record that is claimed to be missing is in the generated JSON file:
Copy code
{
    "urn": "urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer::lb-name",
    "custom": false,
    "type": "aws:lb:ApplicationLoadBalancer",
    "parent": "urn:pulumi:stage1::infra::pulumi:pulumi:Stack::infra-stage1",
    "sourcePosition": "project:///node_modules/@pulumi/lb/application.ts#54,9"
},
All the other records with a reference to the
ApplicationLoadBalancer
mentioned have the URN listed as a parent:
Copy code
"parent": "urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer::lb-name",
The resource does exist in AWS.
i
It looks like the URN in your original error message is different
g
Sorry - I manually changed the actual name for confidentiality reasons.
i
Ah okay, just be careful when examining the state.json file because URNs must match exactly. I think there are some docs on how to manually edit stack state and then import it once done, have a read of those then start seeing what needs to be changed to fix it
g
Makes sense of course. In the original message it's complaining about a R53 resource (
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:route53/record:Record::r53-record
), that depends upon a ALB resource (
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:lb/loadBalancer:LoadBalancer::alb-name
). The R53 record (string) occurs twice in the JSON. Once as a "parent", the other as custom resource (
"custom": true
) in the JSON file. The ALB record string occurs 55 times in the JSON file, but every time as a dependency of another record (either a R53 record or a CloudWatch alarm - which is expected).
So, it would appear that my ALB resource definition is missing. Not sure how it disappeared, but attempting to import it also fails.
i
I wish I could help but I've never had much luck with the import process & I've already lost too many hairs from trying to get it work 😉
although I will say importing via the CLI is much easier than trying to recreate the resource exactly and using the
import
resource option
g
Interestingly though, the resource exists when I view the stack on the web/cloud.
i
when you say "resource exists" do you mean the actual AWS resource, or the resource entry in your stack's state? they are two seperate things
when you view the stack on web/cloud you're viewing the stack state, not the actual AWS concrete resources
g
Well, the ACTUAL resource exists in AWS (it's active and is functional). AND If I go to app.pulumi.com and view my stack's resources, the "missing" ALB resource is in the list.
i
that is strange, if it's in app.pulumi.com then it should also appear in your stack export. Does your project have multiple stacks or just one?
g
Multiple stacks. It seems to be only this one stack that's having this issue.
i
• you have a resource named
r53-resource-name
and another named
lb-name
•
lb-name
is in your stack because you posted the snippet from state.json earlier, which is why you are also seeing it in web view • i assume the
r53-resource-name
is also in your stack's state - because the error message indicates it is there, but it referss to a missing resource
lb-name
• my best guess would be the URNs are not matching • did you perform any
pulumi up
actions using the
--target
flag?
g
• did you perform any
pulumi up
actions using the
--target
flag?
Actually, I did. BUT, it was on a DIFFERENT ALB (in the same stack).
Copy code
# pulumi up --target 'alb-urn' --target-dependents
i
resource53
has a dependency on:
Copy code
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:lb/loadBalancer:LoadBalancer::lb-name
but in your snippet the URN for
lb-name
is:
Copy code
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer::lb-name
these URNs do not match, even though you mention you edited the URNs for privacy
the first URN used by
resource53
indicates a parent-child relationship (the
$
symbol)
they are also completely different resource types the first is a
aws:lb/loadBalancer:LoadBalancer
the second is a
aws:lb:ApplicationLoadBalancer
but they both have the same name
lb-name
- which is typically not allowed I would have thought?
g
I may have "mis-grabbed" earlier (adding to the confusion, so I apologise for that).
According to the error, this one is missing:
Copy code
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer$aws:lb/loadBalancer:LoadBalancer::lb-name
The resource that exists (and shows online) is:
Copy code
urn:pulumi:stage1::infra::aws:lb:ApplicationLoadBalancer::lb-name
So, as you pointed out, the difference is the
$aws
.
i
I have a feeling when you ran with
--target
it updated
lb-name
- but not the reference in
r53-resource-name
- which broke the reference you can go through your history on the Updates tab in Pulumi Cloud to see what each update has applied.
use the Diff & Diagnostics tabs for each update
g
Scanning the resources and history, it's like this
$aws
resource never existed...
Is there anyway (that you're aware of) to recreate a resource, if I can construct the JSON for it? Since all the AWS resources still exist, I can get all the necessary resource paths & Ids from AWS (incluing the AWS Arn for the ALB, as well as all the security group Ids and other AWS resources).
I'm guessing,
pulumi stack import --file JSON-file
But, even when I try to use the
import
, I am seeing the same error. Here's the import JSON:
Copy code
{
  "resources": [
    {
      "type": "aws:lb/loadBalancer:LoadBalancer",
      "name": "lb-name",
      "id": "arn:aws:elasticloadbalancing:us-west-2:123456789123:loadbalancer/app/lb-name/79f63fb45bf44d3b"
    }
  ]
}
Used the docs from this page.