-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: Update to Hookdeck Go SDK v0.0.37 and support more source verifications #28
Conversation
For some reason, the default api.hookdeck.com URL without versioning is running into an issue. I'm removing that from the provider and instead use the latest version from the SDK instead. If people wants to override this value, it's recommended that they include the versioning in their base URL as well.
@alexluong Is there a way we could auto-generate those verifications / inherit from the CLI types? The issue is that we'll be adding hundreds and it seems totally unviable to maintain them in long-term terraform without automation. In theory, the Go SDK should already be auto-updated with new verification providers. |
@alexbouchardd - @alexluong's suggestion as a solution here has been code generation. I'll let him explain why. |
Hi @alexbouchardd! In theory, yes, we just haven't explored that just yet. I mentioned this to @leggetter as potentially something I can explore as well. It would be a generator of some sort to run whenever we want to sync the TF provider with the OpenAPI spec list of source verifications. |
An alternative is to deal with JSON instead of a proper schema. We lose a bit of type safety but it would be more generic and we have to rely on the user to provide a valid source provider configuration. |
That seems like an acceptable solution in the meantime |
This is how the source verification works currently resource "hookdeck_source_verification" "verification_example" {
source_id = hookdeck_source.example.id
verification = {
stripe = {
webhook_secret_key = "secret"
}
}
} To support JSON, I think we can go about it in a few ways 1: Breaking change, new schema resource "hookdeck_source_verification" "verification_example" {
source_id = hookdeck_source.example.id
verification = json({
type = "stripe"
configs = {
webhook_secret_key = "secret"
}
})
} 2: Still use existing schema but with a JSON option resource "hookdeck_source_verification" "verification_example" {
source_id = hookdeck_source.example.id
verification = {
json = json({
type = "stripe"
configs = {
webhook_secret_key = "secret"
}
})
}
} Option 2 is probably a bit more flexible and easier for users. Especially if we want to continue schema support in the future, this is probably a better approach. What do you think? I can look into supporting this option if you think the DX makes sense. |
Option #2 sounds great, it provides a escape hatch for when we haven't added the provider explicitly |
@alexbouchardd @leggetter Added the JSON support as mentioned above. Now this is a valid source verification configuration resource "hookdeck_source_verification" "verification_example" {
source_id = hookdeck_source.example.id
verification = {
json = jsonencode({
type = "stripe"
configs = {
webhook_secret_key = "secret"
}
})
}
} This should give users enough flexibility to handle all cases if the provider hasn't been updated to support their provider just yet. |
Nice 🎉 |
This PR does a few things:
1: update to Hookdeck Go SDK v0.0.37
2: add more source verification providers
3: add JSON source verification support