hashicorp / terraform-provider-terraform

Terraform terraform provider
https://www.terraform.io/docs/providers/terraform/
Mozilla Public License 2.0
24 stars 22 forks source link

Built in terraform provider can not be version pinned #19

Closed hashibot closed 6 years ago

hashibot commented 6 years ago

This issue was originally opened by @joerg as hashicorp/terraform#16994. It was migrated here as a result of the provider split. The original body of the issue is below.


Hi,

I was trying to run terraform in an air gapped environment which gave me troubles with the built in but external terraform provider. I downloaded and placed all necessary providers (including the terraform provider for the remote state) in ~/.terraform.d/plugins/linux_amd64/ and set the version constraints in my base.tf (see config file). Pinning other provider versions works, but pinning this one gives an error. As a user I don't really understand why this provider is "built in to terraform" but still an external file which is versioned and that I have to download separately, but I also don't care too much. The important thing is that I need to make sure everything works and is tested for which version pins are quite important. I think version pinning this provider should be possible since it is and behaves like any other provider from a user perspective.

Terraform Version

joerg@server /tmp % terraform -v
Terraform v0.11.1

Terraform Configuration Files

provider "terraform" {
  version = "= 1.0.2"
}

data "terraform_remote_state" "global" {
  backend = "..."

  config {
    ...
  }
}

Debug Output

joerg@server /tmp % terraform init

Initializing the backend...

Successfully configured the backend "artifactory"! Terraform will automatically
use this backend unless the backend configuration changes.

Initializing provider plugins...

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.
joerg@server  /tmp % terraform plan
Plugin reinitialization required. Please run "terraform init".
Reason: Could not satisfy plugin requirements.

Plugins are external binaries that Terraform uses to access and manipulate
resources. The configuration provided requires plugins which can't be located,
don't satisfy the version constraints, or are otherwise incompatible.

1 error(s) occurred:

* provider.terraform: this provider is built in to Terraform and so it does not support version constraints

Terraform automatically discovers provider requirements from your
configuration, including providers used in child modules. To see the
requirements and constraints from each module, run "terraform providers".

Error: error satisfying plugin requirements

Expected Behavior

Version pin of external provider (by external meaning that it is an external file that needs to be placed somewhere and loaded by terraform) should work.

Actual Behavior

Version pin is not possible.

Steps to Reproduce

See debug output.