-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TestJobQueueUpgrade panics under PlanResourceChange #4015
Comments
I think this is an implicit schema change for aws:batch/computeEnvironment:ComputeEnvironment ec2Configuration at Pulumi provider level. This schema change was not present in TF proper. Perhaps there is a bridge mechanism to compensate and normalize the state for this resource? |
You can override |
That's right. I'll have a look at that indeed. For the bridge, submitting a quick fix to handle diagnostics in upgrade state. We can also consider soft-reporting errors from state upgrades, either always, or when desired_version=current_version. |
I wonder why the new type checking does not catch this? |
Isolating this from an AWS test failure; handling diags turns a panic into a regular error. Looks like the error message is still unfortunate. The test is isolated from pulumi/pulumi-aws#4015
It's not intended to check state. It would be wrong to do so in fact since the state may have been written at a different provider version. This is like pulumi/pulumi-terraform-bridge#1667 but with an additional plot twist that TF schema did not change (1667 does not apply) but Pulumi schema did. |
…4019) Although the upstream schema of batch.ComputeEnvironment did not change between v5 and v6 of pulumi-aws, the Pulumi schema did, and computeResources.ec2Configuration is now an array. Prior to this change pulumi-aws v6 was not able to read the states written by the v5 of the provider correctly, if those states did involve a non-nil computeResources.ec2Configuration. In some of the recent bridge work this also interacted poorly with the new PlanResourceChange machinery causing panics. The change makes the provider automatically apply `x -> [x]` conversions to computeResources.ec2Configuration state. Fixes #4015
The crux of the issue:
Note that there is a problem with aws:batch/computeEnvironment:ComputeEnvironment resource where the 5.42.0 provider
wrote an object for ec2Configuration when a list is expected by the new version, as is also reflected in the Pulumi
schema.
So when upgrading a stack with ComputeEnvironment from 5.42.0 to the latest provider there is an implicit type mismatch.
There appears to be a problem where PlanResourceChange makes it a louder failure than the current silent failure.
Both PlanResourceChange=true and PlanResourceChange=false run state upgraders (although the current and desired version
is 0), and ironically the resource does not define any state upgraders at all.
Note that the state cty.Value passed to the state upgraders differs:
Note that PlanResourceChange=false elegantly bypassed the problem by simply ignoring the data it can't read in
ec2_configuration.
However for PlanResoruceChange=true the TupleVal is hiding an underlying failure of recoverCtyValue:
Which makes sense, it failed to read the object into a slot of type list. Then it decided to use approximate methods to
recover the state, which yielded the TupleVal combined with an ec2_configuration that is now an ObjectVal which is not
expected.
Threading this data through resource upgraders trips up JSONMapToStateValue which responds with a very unhelpful error
message: "missing expected [".
There is another issue where the bridge fails to handle the error diagnostics from the state upgraders, and therefore
panics instead of showing this error.
The text was updated successfully, but these errors were encountered: