`tfe_registry_module` is not created. (resource not found)

I want to create custom module via tfe_registry_module.

But when I create this resource, I keep getting the error. There is absolutely no problem when creating from the Web Console.

resource "tfe_registry_module" "workspace" {
  vcs_repo {
    display_identifier = "MY_ORG/terraform-module-workspace"
    identifier         = "MY_ORG/terraform-module-workspace"
    oauth_token_id     = TOKEN
  }
}
Error: Error creating registry module from repository MY_ORG/terraform-module-workspace: resource not found
with tfe_registry_module.workspace
on modules.tf line 1, in resource "tfe_registry_module" "workspace":
resource "tfe_registry_module" "workspace" {}

Hi Marload,

Try the following

  • Please change the OAuth token , you use to connect to the VCS repository. This will refresh the token and it should work.

  • Second way is provide a fully qualified URL in the identifier of the VCS repo

  1. List item

I experienced the same. However the token used for the tfe provider is being used in several other workspaces, to manage pretty much all other aspects of Terraform Cloud - but still failed on tfe_registry_module.

I replaced the organization API token with a team API token used for the tfe provider, which solved my problem.

This is subtly documented in the bottom of this table: API Tokens - Terraform Cloud | Terraform | HashiCorp Developer, but there’s no mentioning of it on Terraform Registry.

Perhaps it would be a good idea to add a yellow “note” box at the top of the resource documentation? It could have saved me hours and lots of grey hair!