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

Provide a way to configure platforms for Dependency lock file generation #28627

Open
swanandvk opened this issue May 6, 2021 · 1 comment
Open
Labels
enhancement new new issue not yet triaged

Comments

@swanandvk
Copy link

Current Terraform Version

0.14

Use-cases

After performing terraform init .terraform.lock.hcl is generated
which by default is generated for the platform on which user is running terraform init
and with the help of following commands file is updated for other platforms as well

terraform providers lock \
  -platform=linux_arm64 \
  -platform=linux_amd64 \
  -platform=darwin_amd64 \
  -platform=windows_amd64

Attempted Solutions

Proposal

  • providing a way to configure default platforms for generating dependency lock will make it easy for generating it for predefined platforms by just running terraform init instead of manually fixing the file later

  • the possible configure option I can think of is .terraformrc

  • example

provider_installation {

  platforms =[
  linux_arm64, 
  linux_amd64, 
  darwin_amd64, 
  windows_amd64
  ]
}

References

@swanandvk swanandvk added enhancement new new issue not yet triaged labels May 6, 2021
@swanandvk swanandvk changed the title Provide a way to configuration Dependency lock file generation platforms Provide a way to configure platforms for Dependency lock file generation May 7, 2021
@acdha
Copy link

acdha commented Nov 10, 2021

Related issue: #27811 — this problem is massively amplified by terraform providers lock not using the cache.

One alternate proposal: extend the lock file syntax to include the platforms list so the logic could simply be that it will always download and lock the same platforms which were already present in the file. I'm not sure it'd be worth the compatibility hit of changing something like this:

provider "registry.terraform.io/hashicorp/aws" {
  version     = "3.64.2"
  constraints = ">= 3.28.0, >= 3.63.0, ~> 3.63"
  hashes = [
      …  
  ]
}

to

provider "registry.terraform.io/hashicorp/aws" {
  version     = "3.64.2"
  constraints = ">= 3.28.0, >= 3.63.0, ~> 3.63"
  hashes = {
    "linux_amd64": […],
    …  
  }
}

but it seems like this would be an easy way to avoid that while still accomplishing the same goal:

provider "registry.terraform.io/hashicorp/aws" {
  version     = "3.64.2"
  constraints = ">= 3.28.0, >= 3.63.0, ~> 3.63"
  platforms = [
    "linux_amd64",
    "linux_arm64",
    "darwin_amd64",
    "darwin_arm64"
  ]
  hashes = [
      …  
  ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement new new issue not yet triaged
Projects
None yet
Development

No branches or pull requests

2 participants