-
Notifications
You must be signed in to change notification settings - Fork 98
add serverless project import #961
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
Conversation
Co-authored-by: Dmitry Onishchenko <[email protected]>
3f37d7f to
829d086
Compare
ec/acc/security_project_test.go
Outdated
| ResourceName: resourceName, | ||
| ImportState: true, | ||
| ImportStateVerify: true, | ||
| // TODO(gr): reenable after checking the order of product_types is not important |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails with product types because they are not in a stable order. There is already handling for order insensitive equality in
Line 140 in 6b7a1bf
| func (v ProductTypesListValue) ListSemanticEquals(ctx context.Context, otherV basetypes.ListValuable) (bool, diag.Diagnostics) { |
@norrietaylor since you implemented this originally, thoughts on how to resolve this? Why is ListSemanticEquals separate from Equal? Can we sort the product lines as returned from the api or is the order significant elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does using their plancheck interface take semantic equality into account (IIUC it should since it's just asserting there's an empty plan)
ImportPlanChecks: resource.ImportPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectEmptyPlan(),
},
},
Why is ListSemanticEquals separate from Equal?
That's what the Terraform framework wants. Semantically equal values will be substituted by the prior value during plan/apply and so won't trigger errors due to inconsistent state.
Can we sort the product lines as returned from the api or is the order significant elsewhere?
We can, but we're then adding a bunch of code to workaround a test framework limitation which isn't ideal. I'd be surprised if we can't implement adequate validation via ImportPlanChecks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late reply, yep an empty plan should be the equivalent of what ImportStateVerify accomplishes.
Co-authored-by: Toby Brain <[email protected]>
Description
enable serverless project import with
terraform importRelated Issues
closes #918
Motivation and Context
Allows management of existing projects.
How Has This Been Tested?
dev_overridesto import observability and elasticsearch projects manuallyTypes of Changes
Readiness Checklist
Assisted by Cursor AI.