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

Unable to set provider error needs to be improved #19444

Open
trajano opened this issue Nov 22, 2018 · 1 comment
Open

Unable to set provider error needs to be improved #19444

trajano opened this issue Nov 22, 2018 · 1 comment

Comments

@trajano
Copy link

trajano commented Nov 22, 2018

Terraform Version

Terraform v0.11.10
+ provider.aws v1.46.0
+ provider.null v1.0.0
+ provider.random v2.0.0
+ provider.template v1.0.0

Terraform Configuration Files

provider "aws" {
  region  = "us-east-2"
  version = "~> 1.42"
}

provider "aws" {
  alias   = "development_testing"
  region  = "us-east-1"
  version = "~> 1.42"
}

data "aws_s3_bucket" "yum-mirror" {
  provider = "development_testing"
  bucket   = "yum.example"
}

or

resource "aws_s3_bucket" "yum-mirror" {
  provider = "development_testing"
  bucket   = "yum.example"
}

Debug Output

Crash Output

$ terraform plan

Error: module : provider alias must be defined by the module: development_testing

Expected Behavior

There should be no error

Actual Behavior

Error: module : provider alias must be defined by the module:

Steps to Reproduce

terraform plan

Additional Context

  • The project does utilize a module I created.
  • I was assuming S3 buckets are global, but I got
* data.aws_s3_bucket.yum-mirror: data.aws_s3_bucket.yum-mirror: Failed getting S3 bucket: BucketRegionError: incorrect region, the bucket is not in 'us-east-2' region
	status code: 301, request id: , host id:  Bucket: "yum.example"

Which should not be an error since it is a 301 not a 4xx or 5xx

  • A workaround for the time being is to put the ARN explicitly where I need it.

References

@trajano trajano changed the title Unable to set provider in data Unable to set provider error needs to be improved Nov 22, 2018
@trajano
Copy link
Author

trajano commented Nov 22, 2018

Apparently I missed one part in the provider value. I had to prefix it with aws.

That being said the error message of

provider alias must be defined by the module: development_testing

Could be better worded as.

the provider alias is not correctly formatted (probably missing provider type for example aws.development_testing)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants