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

The argument "region" is required, but was not set. #11058

Closed
ghost opened this issue Nov 28, 2019 · 5 comments
Closed

The argument "region" is required, but was not set. #11058

ghost opened this issue Nov 28, 2019 · 5 comments
Labels
bug Addresses a defect in current functionality. upstream-terraform Addresses functionality related to the Terraform core binary.

Comments

@ghost
Copy link

ghost commented Nov 28, 2019

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


I'm using Terraform version 12.16 and trying to run terraform apply to update a deployment.

Terraform v0.12.16
+ provider.aws v2.20.0

Terraform Configuration Files

provider "aws" {
    version = "~> 2.17"
    region = "us-west-2"
}

...

Debug Output

Unable to share.

Expected Behavior

Should succeeed.

Actual Behavior

Error

Steps to Reproduce

  1. terraform init
  2. terraform apply

References

#9989

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Nov 28, 2019
@scalp42
Copy link
Contributor

scalp42 commented Dec 11, 2019

Seeing the same thing here, apply is successful but it output the error everytime on the first run:

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

aws_iam_role_policy_attachment.prod_usw2_prod1_nomad_compute_to_prod1_nomad_compute_efs_kms: Destroying... [id=prod-usw2-prod1-nomad-compute-efs-20190827185557742400000003]
aws_efs_file_system.prod1_nomad_compute_efs: Modifying... [id=fs-5b1642f0]
aws_iam_role_policy_attachment.prod_usw2_prod1_nomad_compute_to_prod1_nomad_compute_efs_kms: Destruction complete after 1s
aws_iam_policy.prod1_nomad_compute_efs_kms: Destroying... [id=arn:aws:iam::087700185875:policy/prod1_nomad_compute_efs_kms]
aws_iam_role.prod_usw2_prod1_nomad_compute_efs: Destroying... [id=prod-usw2-prod1-nomad-compute-efs]
aws_efs_file_system.prod1_nomad_compute_efs: Modifications complete after 1s [id=fs-5b1642f0]
aws_iam_policy.prod1_nomad_compute_efs_kms: Destruction complete after 1s
aws_iam_role.prod_usw2_prod1_nomad_compute_efs: Destruction complete after 1s

Error: Missing required argument

The argument "region" is required, but was not set.

If I run the same apply again, no changes (and the outputs will show up):

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

@evandam
Copy link

evandam commented Dec 12, 2019

I'm seeing the same error on the first terraform apply after a terraform init. Are there any updates on this?

@jjsp556
Copy link

jjsp556 commented Dec 12, 2019

I have the same issue.

terraform 0.12.18
terraform-provider-aws_v2.41.0_x4

Here's an example. Running "terraform apply" on the configuration below will create the two EIPs.

provider "aws" {
    region = "us-east-1"
    alias = "prodalias"
}

resource "aws_eip" "eip_a" {
  vpc = true
  provider = aws.prodalias
}

resource "aws_eip" "eip_b" {
  vpc = true
  provider = aws.prodalias
}

However, if you now update your code and "remove" a resource as depicted below...

provider "aws" {
    region = "us-east-1"
    alias = "prodalias"
}

resource "aws_eip" "eip_a" {
  vpc = true
  provider = aws.prodalias
}

# resource "aws_eip" "eip_b" {
#   vpc = true
#   provider = aws.prodalias
# }

...and run "terraform apply" again, you get the following error message:

...
aws_eip.eip_b: Destroying... [id=eipalloc-0f208a2bcd35ed8c7]
aws_eip.eip_b: Destruction complete after 0s

Error: Missing required argument

The argument "region" is required, but was not set.

Note, eip_b did get successfully destroyed, and running "terraform apply" again after this error message will indicate no changes and exit cleanly.

@bflad bflad added bug Addresses a defect in current functionality. upstream-terraform Addresses functionality related to the Terraform core binary. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 13, 2019
@bflad
Copy link
Contributor

bflad commented Dec 13, 2019

Hi everyone 👋 Thank you for reporting this and sorry you are running into this unexpected behavior.

The output provided by @scalp42 and reproduction provided by @jjsp556 above does seem to highlight some sort of bug within the Terraform CLI where its performing region validation for the "default" provider, even though only aliased provider resources are in use. I have submitted the following upstream to track that issue: hashicorp/terraform#23671

Since there is likely nothing to change or fix in the Terraform AWS Provider for this specific case, I'm going to close this issue in preference of the upstream issue. If you are still having unrelated trouble with the The argument "region" is required, but was not set. error, and #9989 (comment) does not provide any guidance, please submit a fresh new bug report filling out the issue template details and we will take another look.

@bflad bflad closed this as completed Dec 13, 2019
@ghost
Copy link
Author

ghost commented Mar 28, 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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. upstream-terraform Addresses functionality related to the Terraform core binary.
Projects
None yet
Development

No branches or pull requests

4 participants