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

feat(misconf): resolve tf module from OpenTofu compatible registry #6744

Closed
nikpivkin opened this issue May 22, 2024 · 0 comments · Fixed by #6743
Closed

feat(misconf): resolve tf module from OpenTofu compatible registry #6744

nikpivkin opened this issue May 22, 2024 · 0 comments · Fixed by #6743
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Milestone

Comments

@nikpivkin
Copy link
Contributor

OpenTofu has its own module and provider registry with the same HTTP API as Terraform, except for the endpoint response to a module download. OpenTofu returns a response with 200 status code and a body that contains the location of the module. But in some cases the response may be the same as Terraform.

curl https://registry.opentofu.org/v1/modules/terraform-aws-modules/s3-bucket/aws/4.1.2/download
{
  "location": "git::https://github.com/terraform-aws-modules/terraform-aws-s3-bucket?ref=v4.1.2"
}%
cat main.tf
module "bucket" {
  source  = "registry.opentofu.org/terraform-aws-modules/s3-bucket/aws"
  version = "= 4.1.2"
}% 

trivy conf . -d
....
2024-05-22T13:38:58+07:00       DEBUG   [misconf] 38:58.632363000 terraform.parser.<root>.evaluator.resolver Resolving module 'module.bucket' with source: 'registry.opentofu.org/terraform-aws-modules/s3-bucket/aws'...
2024-05-22T13:38:58+07:00       DEBUG   [misconf] 38:58.632389000 terraform.parser.<root>.evaluator.resolver Trying to resolve: cc0c14b7c898f35f408c748e32f7784c
2024-05-22T13:38:58+07:00       DEBUG   [misconf] 38:58.632409000 terraform.parser.<root>.evaluator.resolver no token was found for the registry at registry.opentofu.org
2024-05-22T13:38:58+07:00       DEBUG   [misconf] 38:58.632412000 terraform.parser.<root>.evaluator.resolver Requesting module versions from registry using 'https://registry.opentofu.org/v1/modules/terraform-aws-modules/s3-bucket/aws/versions'...
2024-05-22T13:38:59+07:00       DEBUG   [misconf] 38:59.692377000 terraform.parser.<root>.evaluator.resolver Found version '4.1.2' for constraint '= 4.1.2'
2024-05-22T13:38:59+07:00       DEBUG   [misconf] 38:59.692447000 terraform.parser.<root>.evaluator.resolver Requesting module source from registry using 'https://registry.opentofu.org/v1/modules/terraform-aws-modules/s3-bucket/aws/4.1.2/download'...
2024-05-22T13:38:59+07:00       DEBUG   [misconf] 38:59.921330000 terraform.parser.<root>.evaluator Failed to load module "unexpected status code: 200". Maybe try 'terraform init'?
....
@nikpivkin nikpivkin added kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning labels May 22, 2024
@nikpivkin nikpivkin self-assigned this May 22, 2024
@simar7 simar7 added this to the v0.52.0 milestone May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. scan/misconfiguration Issues relating to misconfiguration scanning
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants