Description
Terraform Version
Terraform v1.11.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.97.0
+ provider registry.terraform.io/hashicorp/external v2.3.5
+ provider registry.terraform.io/hashicorp/http v3.5.0
+ provider registry.terraform.io/hashicorp/local v2.5.2
+ provider registry.terraform.io/hashicorp/null v3.2.4
+ provider registry.terraform.io/hashicorp/tls v4.1.0
Use Cases
I'm a Terraform Cloud customer and I run hosted agents on linux/amd64 while me my coworkers and are working on darwin/arm64.
To make the provider cache work in tfc-agent, the hashes of the agent's platform providers must be present in the workspaces lock files, otherwise the agent will download all the providers at each run.
As we are working on MacOS, our terraform init
or terraform init -upgrade
commands ran in our workspace only vendor the hash for darwin/arm64. We also need to run terraform providers lock -platform=darwin_arm64 -platform=linux_amd64
to vendor hashes for multiple platforms.
I wonder if we could have a configuration in the workspace that automatically forces terraform init
to lock providers for a given set of platforms so that we don't have to run the provider lock command. This would ensure that we don't forget to vendor tfc-agent's platform.
Attempted Solutions
N/A
Proposal
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.70"
platforms = ["linux_amd64", "darwin_arm64"]
}
}
}
References
https://discuss.hashicorp.com/t/terraform-cloud-agent-networking-usage/74434/2