Terraform Version
Terraform v1.3.6
on linux_amd64
Terraform Configuration Files
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
provider "aws" {
region = "us-west-2"
}
provider "aws" {
alias = "global_region"
region = "us-east-1"
}
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "=1.0.0-canary.2"
providers = {
aws.global_region = aws.global_region
}
}
Debug Output
https://gist.github.com/bowtie-ltsa/cb1ef0658cea1433e90531ab0472c066
Expected Behavior
the requested version should have been downloaded, according to my understanding of the docs
https://developer.hashicorp.com/terraform/language/expressions/version-constraints#version-constraint-behavior

Actual Behavior
actual behavior
Error: Unresolvable module version constraint
workaround:
to work-around this problem, you can remove the exact version operator (=) from the version attribute string --
this fails:
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "=1.0.0-canary.2"
...
}
this works:
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "1.0.0-canary.2"
...
}
proposed fix
change this line?
https://github.com/hashicorp/terraform/blob/main/internal/initwd/module_install.go#L390
Because it is looking for an exact string match, ignoring the "=" operator that may be the first character of the version constraint. Right?
Steps to Reproduce
👉 just run terraform init with the above terraform, but to be more precise:
curl -o tf.zip https://releases.hashicorp.com/terraform/1.3.6/terraform_1.3.6_linux_amd64.zip
unzip tf.zip
chmod +x terraform
mkdir ex1
cd ex1
cat <<EOF > main.tf
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 4.0"
}
}
}
provider "aws" {
region = "us-west-2"
}
provider "aws" {
alias = "global_region"
region = "us-east-1"
}
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "=1.0.0-canary.2"
providers = {
aws.global_region = aws.global_region
}
}
EOF
../terraform init
Additional Context
none. I reproduced this in an isolated simple container.
References
No response
Terraform Version
Terraform Configuration Files
Debug Output
https://gist.github.com/bowtie-ltsa/cb1ef0658cea1433e90531ab0472c066
Expected Behavior
the requested version should have been downloaded, according to my understanding of the docs
https://developer.hashicorp.com/terraform/language/expressions/version-constraints#version-constraint-behavior
Actual Behavior
actual behavior
Error: Unresolvable module version constraint
workaround:
to work-around this problem, you can remove the exact version operator (=) from the version attribute string --
this fails:
this works:
proposed fix
change this line?
https://github.com/hashicorp/terraform/blob/main/internal/initwd/module_install.go#L390
Because it is looking for an exact string match, ignoring the "=" operator that may be the first character of the version constraint. Right?
Steps to Reproduce
👉 just run
terraform initwith the above terraform, but to be more precise:Additional Context
none. I reproduced this in an isolated simple container.
References
No response