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

Add support for --provider-schema flag and context to generate sub-command errors #299

Merged
merged 12 commits into from
Nov 20, 2023

Conversation

SBGoods
Copy link
Contributor

@SBGoods SBGoods commented Nov 17, 2023

What?

  • Adds support for --provider-schema argument to pass in a providers schema JSON file. This allows tfplugindocs to skip schema generation by building the provider and running the terraform providers schema -json command.
  • Add schema-json tests equivalents to existing acceptance tests
  • Updates the contributing guide for acceptance testing
  • Refactor generate methods to use g.providerName instead of passing provider name in as a parameter
  • Add more context to errors in generate.go

Why?
The new flag simplifies acceptance testing writing and maintenance by eliminating the need include provider source code in .txtar files.

@SBGoods SBGoods requested a review from a team as a code owner November 17, 2023 20:02
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me 🚀 Super awesome. Just some minor wording suggestions to clarify "schema generation" to mean building the provider and calling Terraform CLI.

.changes/unreleased/ENHANCEMENTS-20231117-151029.yaml Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
internal/cmd/generate.go Outdated Show resolved Hide resolved

switch {
case g.websiteTmpDir == "":
g.websiteTmpDir, err = os.MkdirTemp("", "tfws")
if err != nil {
return err
return fmt.Errorf("error creating temporary website directory: %w", err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️ here and below

@bflad bflad added the enhancement New feature or request label Nov 20, 2023
@bflad bflad added this to the v0.17.0 milestone Nov 20, 2023
Co-authored-by: Brian Flad <bflad417@gmail.com>
@SBGoods SBGoods merged commit 72e4de5 into main Nov 20, 2023
5 checks passed
@SBGoods SBGoods deleted the SBGoods/schema-json-flag branch November 20, 2023 18:56
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants