Skip to content

Unable to generate correct docs when one resource has same name as provider #419

@alexhung

Description

@alexhung

Terraform CLI and terraform-plugin-docs Versions

Terraform v1.9.5
on darwin_amd64
+ provider registry.terraform.io/jfrog/project v1.9.1
tfplugindocs Version dev // v0.20.0 in go.mod

Provider Code

terraform {
  required_providers {
    project = {
      source  = "jfrog/project"
      version = "1.9.0"
    }
  }
}

resource "project" "myproject" {
  key = "myproj"
  display_name = "My Project"
  description  = "My Project"
  admin_privileges {
    manage_members   = true
    manage_resources = true
    index_resources  = true
  }
  max_storage_in_gibibytes   = 10
  block_deployments_on_limit = false
  email_notification         = true
}

Expected Behavior

Able to generate correct doc files for all other resources when one resource has same name as the provider. In our case, the provider name is project and one of the resource name is also project.

Actual Behavior

When tfplugindocs generate is executed, all the resource docs are replaced by content from resource project doc.

Steps to Reproduce

  1. tfplugindocs generate. That's all required.

How much impact is this issue causing?

High

Logs

https://gist.github.com/alexhung/da5c294048169cef6cd73f026804bdb8

Additional Information

After generating doc, all resource doc files are modified even though none should be updated.

alexh@alexh-mac terraform-provider-project % git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   docs/resources/environment.md
	modified:   docs/resources/group.md
	modified:   docs/resources/project.md
	modified:   docs/resources/repository.md
	modified:   docs/resources/role.md
	modified:   docs/resources/share_repository.md
	modified:   docs/resources/share_repository_with_all.md
	modified:   docs/resources/user.md

no changes added to commit (use "git add" and/or "git commit -a")

Using --provider-name arg has no effect.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions