Skip to content

[DRAFT] Mirror of PR 489 #494

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

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changes/unreleased/ENHANCEMENTS-20250613-162958.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
kind: ENHANCEMENTS
body: 'generate: Remove trailing whitespace from default function template when `.HasVariadic` evaluates to false'
time: 2025-06-13T16:29:58.411584-04:00
custom:
Issue: "489"
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ cmp docs/index.md expected-index.md
cmp docs/data-sources/example.md expected-datasource.md
cmp docs/resources/example.md expected-resource.md
cmp docs/functions/example.md expected-function.md
cmp docs/functions/no-variadic.md expected-no-variadic-function.md
cmp docs/ephemeral-resources/example.md expected-ephemeral-resource.md

-- expected-output.txt --
Expand All @@ -22,6 +23,7 @@ generating missing data source content
generating new template for data-source "scaffolding_example"
generating missing function content
generating new template for function "example"
generating new template for function "no-variadic"
generating missing ephemeral resource content
generating new template for "scaffolding_example"
generating missing provider content
Expand All @@ -32,6 +34,7 @@ rendering templated website to static markdown
rendering "data-sources/example.md.tmpl"
rendering "ephemeral-resources/example.md.tmpl"
rendering "functions/example.md.tmpl"
rendering "functions/no-variadic.md.tmpl"
rendering "index.md.tmpl"
rendering "resources/example.md.tmpl"
-- expected-datasource.md --
Expand Down Expand Up @@ -99,6 +102,38 @@ example(input string, variadicInput string...) string
1. `input` (String) Value to echo.
<!-- variadic argument generated by tfplugindocs -->
1. `variadicInput` (Variadic, String) Variadic input to echo.
-- expected-no-variadic-function.md --
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "no-variadic function - terraform-provider-scaffolding"
subcategory: ""
description: |-
Echo a string
---

# function: no-variadic

Given a string value, returns the same value.

## Example Usage

```terraform
output "test" {
value = provider::scaffolding::no-variadic("testvalue1")
}
```

## Signature

<!-- signature generated by tfplugindocs -->
```text
no-variadic(input string) string
```

## Arguments

<!-- arguments generated by tfplugindocs -->
1. `input` (String) Value to echo.
-- expected-index.md --
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
Expand Down Expand Up @@ -208,6 +243,10 @@ data "scaffolding_example" "example" {
output "test" {
value = provider::scaffolding::example("testvalue1", "testvalue2")
}
-- examples/functions/no-variadic/function.tf --
output "test" {
value = provider::scaffolding::no-variadic("testvalue1")
}
-- examples/provider/provider.tf --
provider "scaffolding" {
# example configuration here
Expand Down Expand Up @@ -341,6 +380,18 @@ resource "scaffolding_example" "example" {
"description": "Variadic input to echo.",
"type": "string"
}
},
"no-variadic": {
"description": "Given a string value, returns the same value.",
"summary": "Echo a string",
"return_type": "string",
"parameters": [
{
"name": "input",
"description": "Value to echo.",
"type": "string"
}
]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ description: |-
## Arguments

{{ .FunctionArgumentsMarkdown }}
{{ if .HasVariadic -}}
{{- if .HasVariadic }}
{{ .FunctionVariadicArgumentMarkdown }}
{{- end }}
`
Expand Down