cyrilgdn / terraform-provider-postgresql

Terraform PostgreSQL provider
https://www.terraform.io/docs/providers/postgresql/
Mozilla Public License 2.0
356 stars 181 forks source link

Docs page urls incompatible with terraform-docs #356

Open z0rc opened 9 months ago

z0rc commented 9 months ago

Terraform Version

Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/cyrilgdn/postgresql v1.21.0

Affected Resource(s)

Terraform Configuration Files

N/A

Expected Behavior

Links to provider's resources generated by terraform-docs should be correct.

Actual Behavior

Links return 404.

Steps to Reproduce

  1. In empty folder create test.tf with following contents
    resource "postgresql_database" "test" {
     name = "test"
    }
  2. run terraform-docs markdown table --show resources .
  3. output:

    ## Resources
    
    | Name | Type |
    |------|------|
    | [postgresql_database.test](https://registry.terraform.io/providers/cyrilgdn/postgresql/latest/docs/resources/database) | resource |

Important Factoids

Out of all terraform providers I use (aws, vault, random etc) only this one has problem with links generated by terraform-docs. Checking other providers website folders (https://github.com/hashicorp/terraform-provider-vault/tree/main/website/docs/r or https://github.com/hashicorp/terraform-provider-aws/tree/main/website/docs/r) I see that page names aren't prefixed with provider name. But with this provider they are (https://github.com/cyrilgdn/terraform-provider-postgresql/tree/master/website/docs/r).

This isn't a problem for registry or viewing docs via browser, everything works as expected. It's a problem for documentation generated by terraform-docs when referencing resources from this provider.

I looked into https://developer.hashicorp.com/terraform/tutorials/providers/provider-release-publish#document-your-provider, and page name style isn't defined. There is some more info at https://github.com/hashicorp/terraform-plugin-docs#conventional-paths, but it doesn't define names well tool.

References

Similar issue created on terraform-docs side for other provider, but I believe terraform-docs isn't able to fix it as link generation is based on assumption/convention of how pages should be named.