Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The list and search module API calls should not return all module versions, should instead return unique modules latest version #94

Open
xRokco opened this issue Mar 11, 2022 · 0 comments

Comments

@xRokco
Copy link

xRokco commented Mar 11, 2022

Currently when you do a list or search module API call Citizen returns every module version rather than just the most recent version of each unique module. For example, consider this API call from my test server:

✦ ➜ curl -s https://some.citizen.server/v1/modules | jq -r ".modules[].id"    
citizen-test/aws-s3/aws/1.0.0
citizen-test/aws-s3/aws/1.0.1
citizen-test/aws-s3/aws/2021.9.27
bucket-test/aws-s3/dev/20219.29.1632949748
bucket-test/ecr-repository/dev/20219.29.1632949748
bucket-test/aws-s3/dev/20219.29.1632949794
bucket-test/ecr-repository/dev/20219.29.1632949794
bucket-test/aws-s3/dev/20219.29.1632951012
bucket-test/ecr-repository/dev/20219.29.1632951012
bucket-test/aws-s3/dev/20219.29.1632951202
bucket-test/ecr-repository/dev/20219.29.1632951202
bucket-test/aws-s3/dev/20219.29.1632951228
bucket-test/ecr-repository/dev/20219.29.1632951228
bucket-test/aws-s3/dev/20219.29.1632951281
bucket-test/ecr-repository/dev/20219.29.1632951281

with the default limit of 15, Citizen is only returning 3 unique modules, the rest are duplicates with different versions.

The Terraform Registry docs admittedly isn't exactly clear on this:

These endpoints list modules according to some criteria.

But it does say list modules rather than list module versions.

If I compare the results I get for querying the public Terraform registry at registry.terraform.io, I can't get it to return duplicate modules with either a list or search query:

➜ curl -s https://registry.terraform.io/v1/modules/terraform-aws-modules\?limit\=100 | jq -r ".modules[].id"
terraform-aws-modules/lambda/aws/2.34.1
terraform-aws-modules/rds-aurora/aws/6.1.4
terraform-aws-modules/rds/aws/4.1.3
terraform-aws-modules/s3-bucket/aws/2.14.1
terraform-aws-modules/customer-gateway/aws/2.0.0
terraform-aws-modules/atlantis/aws/3.12.0
terraform-aws-modules/route53/aws/2.5.0
terraform-aws-modules/vpc/aws/3.12.0
terraform-aws-modules/apigateway-v2/aws/1.5.1
terraform-aws-modules/elb/aws/3.0.1
terraform-aws-modules/transit-gateway/aws/2.5.1
terraform-aws-modules/autoscaling/aws/5.1.1
terraform-aws-modules/vpn-gateway/aws/2.11.1
terraform-aws-modules/iam/aws/4.14.0
terraform-aws-modules/acm/aws/3.3.0
terraform-aws-modules/dynamodb-table/aws/1.2.2
terraform-aws-modules/eventbridge/aws/1.14.0
terraform-aws-modules/cloudwatch/aws/2.4.1
terraform-aws-modules/appsync/aws/1.4.0
terraform-aws-modules/eks/aws/18.9.0
terraform-aws-modules/redshift/aws/3.4.1
terraform-aws-modules/ecs/aws/3.4.1
terraform-aws-modules/sns/aws/3.3.0
terraform-aws-modules/sqs/aws/3.3.0
terraform-aws-modules/alb/aws/6.7.0
terraform-aws-modules/pricing/aws/1.3.0
terraform-aws-modules/key-pair/aws/1.0.1
terraform-aws-modules/cloudfront/aws/2.9.2
terraform-aws-modules/ebs-optimized/aws/0.2.1
terraform-aws-modules/ec2-instance/aws/3.4.0
terraform-aws-modules/notify-slack/aws/4.24.0
terraform-aws-modules/security-group/aws/4.8.0
terraform-aws-modules/step-functions/aws/2.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant