-
Notifications
You must be signed in to change notification settings - Fork 44
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
[any-tf-provider] Switch args parsing to cobra #2742
Conversation
316be51
to
c61588b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2742 +/- ##
==========================================
- Coverage 69.64% 69.62% -0.03%
==========================================
Files 301 302 +1
Lines 38726 38736 +10
==========================================
- Hits 26971 26969 -2
- Misses 10237 10250 +13
+ Partials 1518 1517 -1 ☔ View full report in Codecov by Sentry. |
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.
Approving because of time zone differences.
I really like keeping test utils in their own module, for the record, because it makes them much more discoverable. But I also ideally want that to be part of a concerted effort to consolidate and centralize such utilities. I worry that adding them in this way would not facilitate that.
c61588b
to
04fb870
Compare
04fb870
to
14e4ec1
Compare
This gets us out of the business of writing flag parsing. This does change the format of options. Before, they looked like: ```console $ pulumi package get-schema registry.opentofu.org/owner/provider version fullDocs=true ``` They now look like: ```console $ pulumi package get-schema -- registry.opentofu.org/owner/provider version --fullDocs ```
14e4ec1
to
bab1834
Compare
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.
Thanks for the extra docs!
@@ -243,6 +243,28 @@ func ReadResourceRequest(i *tfprotov6.ReadResourceRequest) *tfplugin6.ReadResour | |||
} | |||
} | |||
``` | |||
|
|||
### `package parameterize` |
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.
Thanks for documenting! Docs are very good to have.
We're still figuring out what's our style for docs - so happy to discuss alternatives. One pattern I've used before in this repo is package.go
with doc comment describing what each package does. This seems to be some support for this in e.g. https://tip.golang.org/doc/comment#package - this also gets copied into auto-generated Go docs.
The README is also very important. There's "how do I use this" and "what can it do" concerns that go in a README. Not sure what's the right balance for us is here but my 2c so you're aware of the package.go option for the package-level detail.
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.
It's a good call-out. The bridge also has 1 doc.go
, and I've seen more in the wild.
For this PR, I'm going to keep using the README.md, since that's what the module already does. It might be worth standardizing at some point.
Autogenerated Go docs also include the README: https://pkg.go.dev/github.com/pulumi/pulumi-terraform-bridge/dynamic.
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.
Step One: Have docs ✅
Step Two: Have docs be discoverable 👓
Step Three: Profit Standardization 🎉
We'll get there, especially as we continue thinking about this.
Update: Rebased against #2742 which adds Cobra. Blocked until that merges. This pull request adds a `registryDocs` Generator to the initialSetup call for a dynamic provider. Adjustments to accommodate this change: - Because the generation instructions will necessarily include the string `terraform`, the section needs to be added after the edit rules are applied. - The logic to determine which installation instruction to generate is hinged on `info.Repository`, which is the source repo of the provider. If it doesn't contain "pulumi" then we're dealing with an Any TF provider. - `_index.md` is written to a user-specified (via flag) `--indexDocOutDir`. This allows us to write to any location in a file system. Leaving this blank prompts the file to only get written to the virtual filesystem in the bridge. - An integration test is added that verifies generation and translation of the `_index.md` file` from hashicorp/random. --------- Co-authored-by: Ian Wahbe <me@iwahbe.com>
This PR has been shipped in release v3.99.0. |
Simplify args parsing by using cobra.
My hope is that this will make the implementation of #2717 much easier.