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

Terraform 0.13 Error: Duplicate required providers configuration #25364

Closed
jyoder-deloitte opened this issue Jun 24, 2020 · 2 comments
Closed
Labels
v0.13 Issues (primarily bugs) reported against v0.13 releases

Comments

@jyoder-deloitte
Copy link

Terraform Version

NOTE: The bug report comments suggest running terraform -v which is no longer a valid flag in 0.13. terraform version works

Terraform v0.13.0-beta2

Terraform Configuration Files

provider_ns1.tf

terraform {
  required_providers {
    ns1 = {
      source  = "terraform-providers/ns1"
      version = "~> 1.5"
    }
  }
}

providers.tf

/******************************************************************************
 * Provider Config
 *****************************************************************************/
terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 2.65"
    }
    local = {
      source  = "hashicorp/local"
      version = "~> 1.4.0"
    }
  }

  required_version = ">= 0.13"
}

Expected Behavior

I should still be able to separate provider configurations into separate files. required_providers configurations should merge together into a single block as files are processed. Duplicate providers in the merged block should cause an error.

Actual Behavior

Error: Duplicate required providers configuration

  on providers.tf line 5, in terraform:
   5:   required_providers {

A module may have only one required providers configuration. The required
providers were previously configured at provider_ns1.tf:2,3-21.

Steps to Reproduce

  1. terraform init
@alisdair alisdair added the v0.13 Issues (primarily bugs) reported against v0.13 releases label Jun 24, 2020
@pselle
Copy link
Contributor

pselle commented Jun 24, 2020

Hello @jyoder-deloitte, thank you for this report!

This is a known breaking change we are adding in 0.13, and you can read the relevant PR here: #24763. I'll borrow from the summary of that PR here:

We now permit at most one required_providers block per module (except for overrides). This prevents users (and Terraform) from struggling to understand how to merge multiple required_providers configurations, with version and source attributes split across multiple blocks.

This is a purposeful change for 0.13, so I'm going to close this issue.

As well, thank you for the note about terraform -v! This was accidentally broken when adding a different feature allowing json output from the version command, and has since been fixed.

@pselle pselle closed this as completed Jun 24, 2020
@ghost
Copy link

ghost commented Jul 25, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked and limited conversation to collaborators Jul 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
v0.13 Issues (primarily bugs) reported against v0.13 releases
Projects
None yet
Development

No branches or pull requests

3 participants