minamijoyo/tfupdate

Cannot fetch the latest version of modules in Terraform Registry

Closed this issue · 2 comments

Tried to fetch the latest version of modules in Terraform Registry, but the command shows an error.

Steps to Reproduce

Installed the latest tfupdate

$ git clone https://github.com/minamijoyo/tfupdate
$ cd tfupdate/
$ make install
$ tfupdate --version
0.3.5

Expected Behavior

$ tfupdate release latest {namespace/name/provider} returns the latest version of modules

Actual Behavior

$ tfupdate release latest terraform-aws-modules/vpc/aws
failed to get the latest release for terraform-aws-modules/vpc/aws: GET https://api.github.com/repositories/101660954/aws/releases/latest: 404 Not Found []

$ tfupdate release latest terraform-aws-modules/security-group/aws
failed to get the latest release for terraform-aws-modules/security-group/aws: GET https://api.github.com/repos/terraform-aws-modules/security-group/aws/releases/latest: 404 Not Found []

The same issue happened with docker as well.

$ docker run -it --rm minamijoyo/tfupdate release latest terraform-aws-modules/vpc/aws
failed to get the latest release for terraform-aws-modules/vpc/aws: GET https://api.github.com/repositories/101660954/aws/releases/latest: 404 Not Found []

$ docker run -it --rm minamijoyo/tfupdate release latest terraform-aws-modules/security-group/aws
failed to get the latest release for terraform-aws-modules/security-group/aws: GET https://api.github.com/repos/terraform-aws-modules/security-group/aws/releases/latest: 404 Not Found []

Maybe I'm missing something, but any insight?

P.S. Thank you so much for the great tool

Hi, @sharu1204
The default source type is github (for historical reason). You should use --source-type=tfregistryModule option to fetch the latest version of modules in Terraform Registry.

$ tfupdate release latest --help
Usage: tfupdate release latest [options] <SOURCE>

Arguments
  SOURCE             A path of release data source.
                     Valid format depends on --source-type option.
                       - github or gitlab:
                         owner/repo
                         e.g. terraform-providers/terraform-provider-aws
                      - tfregistryModule
                         namespace/name/provider
                         e.g. terraform-aws-modules/vpc/aws

Options:
  -s  --source-type  A type of release data source.
                     Valid values are
                       - github (default)
                       - gitlab
                       - tfregistryModule

Try the followings:

$ tfupdate release latest --source-type=tfregistryModule terraform-aws-modules/vpc/aws
2.38.0

$ tfupdate release latest --source-type=tfregistryModule terraform-aws-modules/security-group/aws
3.10.0

Thanks for the explanation. It perfectly worked. I will close it