Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

TF: autogenerate ref docs#790

Merged
marcoandredinis merged 5 commits into
masterfrom
marco/autogenerate_tfref
May 18, 2023
Merged

TF: autogenerate ref docs#790
marcoandredinis merged 5 commits into
masterfrom
marco/autogenerate_tfref

Conversation

@marcoandredinis
Copy link
Copy Markdown
Contributor

@marcoandredinis marcoandredinis commented Mar 21, 2023

Generates a reference.md which should then be copied to
https://github.com/gravitational/teleport/blob/branch/v12/docs/pages/reference/terraform-provider.mdx
Which is exposed here: https://goteleport.com/docs/reference/terraform-provider/

There are some changes because of new fields and login rule reference was moved (to keep an ordered list of resources).

Fixes gravitational/teleport#22083

@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch 4 times, most recently from 44044fa to 9e4cc76 Compare March 24, 2023 11:52
@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch 6 times, most recently from 6815727 to 4565706 Compare May 3, 2023 17:50
@marcoandredinis marcoandredinis requested a review from ptgott May 3, 2023 17:51
@marcoandredinis marcoandredinis marked this pull request as ready for review May 3, 2023 17:51
@marcoandredinis marcoandredinis requested a review from hugoShaka May 5, 2023 07:19
@hugoShaka
Copy link
Copy Markdown
Contributor

Fixes gravitational/teleport#22083

@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch 2 times, most recently from d13a4a1 to 7d54a2b Compare May 9, 2023 13:23
Comment thread terraform/gen/main.go Outdated
}
sort.Strings(sortedNames)

fmt.Fprintln(fp, referenceDocsTitle)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

non-blocking: I'd prefer using a set of go templates and functions, this would be more readable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed 👍
I'll change it to use a template

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you please take another look?

Comment thread terraform/_gen/schema_dump.go
@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch 2 times, most recently from 2b55777 to 7788206 Compare May 16, 2023 07:31
@ptgott ptgott linked an issue May 16, 2023 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@ptgott ptgott left a comment

Choose a reason for hiding this comment

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

Thanks for putting this together! I agree with Hugo re: the template comment, but also that it's fine to leave it for later.

Copy link
Copy Markdown
Contributor

@ptgott ptgott left a comment

Choose a reason for hiding this comment

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

Actually, one thing

Comment thread terraform/reference.md
title: Terraform provider resources
description: Terraform provider resources reference
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One thing we should definitely do is indicate that this page was automatically generated using this script and include the teleport-plugins URL. In the docs, content pages include commands using this syntax:

{/*comment text*/}

We should also use mdx for the file extension, not md, to keep this consistent with the rest of the docs (I'm actually not sure if the docs engine cares, so this is just to be safe.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Can you please take another look?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The comment will need to go below the frontmatter block for this to render properly, but otherwise looks great!

@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch from 7788206 to a52e516 Compare May 18, 2023 07:58
@marcoandredinis marcoandredinis requested a review from hugoShaka May 18, 2023 07:59
@marcoandredinis marcoandredinis force-pushed the marco/autogenerate_tfref branch from a52e516 to 2d35a7b Compare May 18, 2023 08:00
Comment thread terraform/gen/referencedocs.go.tpl Outdated
Comment on lines +1 to +6
{/* Content generated by teleport-plugins/terraform/gen/main.go DO NOT EDIT */}
---
title: Terraform provider resources
description: Terraform provider resources reference
---

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
{/* Content generated by teleport-plugins/terraform/gen/main.go DO NOT EDIT */}
---
title: Terraform provider resources
description: Terraform provider resources reference
---
---
title: Terraform provider resources
description: Terraform provider resources reference
---
{/* Content generated by teleport-plugins/terraform/gen/main.go DO NOT EDIT */}

Otherwise the title won't render

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terraform reference examples don't pass user traits properly terraform provider documentation improvement

4 participants