hashicorp / hashicorp/terraform-plugin-docs

Missing template functions

Open
#591 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
263
Forks
84
Avg merge
3d 6h
Merged PRs (30d)
2

Description

### Terraform CLI and terraform-plugin-docs Versions

- `Terraform v1.14.0 on linux_amd64`
- `tfplugindocs Version 0.24.0 from commit v0.24.0`

### Use Cases or Problem Statement

I'm using custom templates and would need some `hasSuffix` function for strings in it.

Currently I have to solve this via the split function which is pretty ugly and not straight forward.

https://github.com/stackitcloud/terraform-provider-stackit/blob/5e12fb90e44636e388cebaa68fb42eb39487c0d5/templates/resources.md.tmpl#L8-L21

### Proposal

**Option 1: Add more template functions to the existing list**

Add https://pkg.go.dev/strings#HasSuffix to the list of the template functions:

https://github.com/hashicorp/terraform-plugin-docs/blob/e5b0eeb7818b2baab5c8c0340790b4a936406c4c/internal/provider/template.go#L113-L123

**Option 2: Allow users to register their own template functions**

Not sure if that's easy to implement.

### How much impact is this issue causing?

Low

### Additional Information

Will create some PR for Option 1 later.

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.