Loading...
Loading...
### Terraform Version ```shell Terraform v1.12.2 on linux_amd64 ``` ### Terraform Configuration Files example from [docker turotial](https://developer.hashicorp.com/terraform/tutorials/docker-get-started/docker-build#prerequisites): ```terraform terraform { required_providers { docker = { source = "kreuzwerker/docker" version = "~> 3.0.1" } } } provider "docker" {} resource "docker_image" "nginx" { name = "nginx:latest" keep_locally = false } resource "docker_container" "nginx" { image = docker_image.nginx.image_id name = "tutorial" ports { internal = 80 external = 8000 } } ``` ### Debug Output if i add a space in line 5 after `~>` and try `terraform init` again even after using `terraform fmt` ### Expected Behavior Initializing the backend... Initializing provider plugins... - Finding kreuzwerker/docker versions matching "~> 3.0.1"... - Installing kreuzwerker/docker v3.0.2... - Installed kreuzwerker/docker v3.0.2 (self-signed, key ID BD080C4571C6104C) Partner and community providers are signed by their developers. If you'd like to know more about provider signing, you can read about it here: https://developer.hashicorp.com/terraform/cli/plugins/signing Terraform has created a lock file .terraform.lock.hcl to record the provider selections it made above. Include this file in your version control repository so that Terraform can guarantee to make the same selections by default when you run "terraform init" in the future. Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary. ### Actual Behavior ``` Initializing the backend... ╷ │ Error: Invalid version constraint │ │ on main.tf line 3, in terraform: │ 3: docker = { │ 4: source = "kreuzwerker/docker" │ 5: version = "~> 3.0.1" │ 6: } │ │ Incorrect version constraint syntax: invalid specification "~> 3.0.1": only one space is expected after the operator "~>". ``` ### Steps to Reproduce 2. add the `main.tf`: ```terraform terraform { required_providers { docker = { source = "kreuzwerker/docker" version = "~> 3.0.1" } } } provider "docker" {} resource "docker_image" "nginx" { name = "nginx:latest" keep_locally = false } resource "docker_container" "nginx" { image = docker_image.nginx.image_id name = "tutorial" ports { internal = 80 external = 8000 } } ``` 2.`terraform f` 3.`terraform init` ### Additional Context _No response_ ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.