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

Log/Output Provider Binary Path When Used #123

Open
tekumara opened this issue Mar 14, 2022 · 3 comments
Open

Log/Output Provider Binary Path When Used #123

tekumara opened this issue Mar 14, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@tekumara
Copy link

example:

// service_account resource schema
func (r serviceAccountResourceType) GetSchema(_ context.Context) (tfsdk.Schema, diag.Diagnostics) {
	return tfsdk.Schema{

		MarkdownDescription: "Service account resource",

		Attributes: map[string]tfsdk.Attribute{
			"id": {
				Type:     types.StringType,
				Computed: true,
				MarkdownDescription: "Server generated UUID",
			},
			"name": {
				Type:     types.StringType,
				Required: true,
				Validators: []tfsdk.AttributeValidator{
					validate.StringNotNull(),
				},
			},
			"role": {
				Type:     types.StringType,
				Required: true,
				Validators: []tfsdk.AttributeValidator{
					validate.RoleIsValid(),
				},
			},
			"membership_id": {
				Type:     types.StringType,
				Computed: true,
				MarkdownDescription: "Server generated UUID",
			},
		},
	}, nil
}

Both Description and MarkdownDescription are ignored.

github.com/hashicorp/terraform-plugin-docs v0.5.1

@bflad
Copy link
Member

bflad commented Mar 14, 2022

Hi @tekumara 👋 Thank you for raising this and sorry you ran into trouble here.

I'm not able to reproduce this using the main branch of terraform-provider-scaffolding-framework. I verified the functionality by updating the descriptions of the resource and an attribute, running go generate ./..., then verifying the output Markdown files were updated.

I'm curious if you might have run into one of the following:

  • cannot find module providing package github.com/hashicorp/terraform-exec/tfinstall #122, which would've temporarily prevented the tfplugindocs tool from working with the terraform-plugin-sdk v2.11.0 release on Friday. This is fixed with v0.6.0 released today.
  • The provider codebase missing a comment such as //go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs (or some human or other process running the underlying tfplugindocs command)

If everything is up to date and something is executing the tfplugindocs command, please feel free to open with additional details for how to reproduce this issue and we can take a fresh look. 👍

@bflad bflad closed this as completed Mar 14, 2022
@tekumara
Copy link
Author

Thanks @bflad I've done some more digging ...

So when I run terraform providers schema -json I can see that my provider attributes have a description field but my resources have none. So tfplugindocs has nothing to work with.

I think what's happening is that tfplugindocs, regardless whether its run via go generate or go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs is using the last installed version of my provider in $GOBIN rather than my source. My last installed version was out of date and didn't have the description field changes I made 😥.

So instead, I'll make sure I rebuild and install my provider into $GOBIN first and then generate the docs. 😄

@bflad
Copy link
Member

bflad commented Mar 15, 2022

@tekumara this is great information and seems like this behavior should be better documented or the tool should provide some additional logging that mentions which provider binary might be in use. I'm going to reopen this to explore this further. Thanks for the followup!

@bflad bflad reopened this Mar 15, 2022
@bflad bflad changed the title Attribute descriptions are ignored Log/Output Provider Binary Path When Used Jan 24, 2024
@bflad bflad added the enhancement New feature or request label Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants