Skip to content
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

refactor: Implement interface for source verification provider #47

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexluong
Copy link
Collaborator

@alexluong alexluong commented May 4, 2024

This is a proof of concept PR as I'm exploring a small refactor around source verification. Please do NOT merge!


Previously, the steps to add new provider is (example platform: Acme)

  • add new provider code sourceverification/verification_acme.go
  • update Terraform model types at sourceverification/model.go
  • update Terraform schema logic at sourceverification/schema.go
  • update SDK logic at sourceverification/sdk.go

Of all these steps, the SDK logic is the most tedious as it usually takes me some time to locate the right place before adding 2 lines of code. It's a bit scary since if there's a bug in this step, we won't realize it until it's properly tested end-to-end.


I want to reduce the process to just one single step

  • add new provider code sourceverification/verification_acme.go

However, I have not been able to achieve this goal yet. The main challenge is the Terraform static types. I haven't been able to figure out a way to do so dynamically just yet. Therefore, this is where we're at with this PR

  • add new provider code sourceverification/verification_acme.go
  • update Terraform model types at sourceverification/model.go

I do think this is a significant step up from before as it's quite straightforward to update these 2 steps.


To be honest, I'm not 100% happy with where things are at yet. However, given that this is not a huge value add (more internal DX vs actual value for users), I'm not sure if we should continue exploring this effort further. Just want to share this idea and my progress here if you want to explore this idea further!

@alexbouchardd
Copy link
Contributor

alexbouchardd commented May 5, 2024

That already feels like a meaningful improvement. Looking forward, we'll be adding hundreds of providers and we should be looking into how that can be fully automated across all the product surface, terraform included.

Technically, the Go SDK already has automated support for new providers; we should be able to either inherit the types & configuration or have a code-gen script that takes the Go SDK types, generates, and then commits the TF changes.

cc @leggetter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants