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

An error 401 occurred while creating an S3 bucket #15578

Closed
ghost opened this issue Oct 9, 2020 · 4 comments
Closed

An error 401 occurred while creating an S3 bucket #15578

ghost opened this issue Oct 9, 2020 · 4 comments
Labels
bug Addresses a defect in current functionality. service/s3 Issues and PRs that pertain to the s3 service.

Comments

@ghost
Copy link

ghost commented Oct 9, 2020

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


When I was creating the S3 bucket, an unexpected error occurred in 401, my AK/SK was the administrator!

Terraform Version

Terraform v0.13.4
+ provider registry.terraform.io/hashicorp/aws v3.8.0

Terraform Configuration Files

provider "aws" {
  region     = "cn-northwest-1"
  access_key = "xxx"
  secret_key = "xxx"
}

resource "aws_s3_bucket" "test" {
  bucket = "tf-my-test-yc"
  acl    = "private"

  versioning {
    enabled = true
  }

  tags = {
    Name        = "My bucket"
    Environment = "Dev"
  }
}

output "bucket" {
  value = aws_s3_bucket.test
}

Debug Output

2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: -----------------------------------------------------
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: 2020/10/09 15:50:35 [DEBUG] [aws-sdk-go]
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: ObjectLockConfigurationNotFoundErrorObject Lock configuration does not exist for this bucketfastone-test-yc0TCXAZ6K3SDW8TFPthGIjPE9gf1zmvTIkTCAQeR3HIJLBznVi7tRFYpgi7MKMXE/LAlUphGMuxfHCyrUzWu6ojex9eY=
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: 2020/10/09 15:50:35 [DEBUG] [aws-sdk-go] DEBUG: Validate Response s3/GetObjectLockConfiguration failed, attempt 0/25, error ObjectLockConfigurationNotFoundError: Object Lock configuration does not exist for this bucket
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: status code: 404, request id: 0TCXAZ6K3SDW8TFP, host id: thGIjPE9gf1zmvTIkTCAQeR3HIJLBznVi7tRFYpgi7MKMXE/LAlUphGMuxfHCyrUzWu6ojex9eY=
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: 2020/10/09 15:50:35 [DEBUG] Waiting for state to become: [success]
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: 2020/10/09 15:50:35 [DEBUG] [aws-sdk-go] DEBUG: Request s3/HeadBucket Details:
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: ---[ REQUEST POST-SIGN ]-----------------------------
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: HEAD / HTTP/1.1
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Host: fastone-test-yc.s3.cn-northwest-1.amazonaws.com.cn
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: User-Agent: aws-sdk-go/1.34.26 (go1.14.5; windows; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.13.4 (+https://www.terraform.io)
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe:
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe:
2020-10-09T15:50:35.800+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: -----------------------------------------------------
2020-10-09T15:50:36.068+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: 2020/10/09 15:50:36 [DEBUG] [aws-sdk-go] DEBUG: Response s3/HeadBucket Details:
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: ---[ RESPONSE ]--------------------------------------
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: HTTP/1.1 401 Unauthorized
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Connection: close
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Transfer-Encoding: chunked
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Content-Type: application/xml
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Date: Fri, 09 Oct 2020 07:50:35 GMT
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: Server: AmazonS3
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: X-Amz-Id-2: nwQNmRMsx+YccazGcstBKp3DuZMBkuP7taYc23jugsdQKEjNw9x5d6Hsl+x9Wzz+XFqn2zqPtKI=
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: X-Amz-Request-Id: 2B4619AA7944B507
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe:
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe:
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe:
2020-10-09T15:50:36.069+0800 [DEBUG] plugin.terraform-provider-aws_v3.8.0_x5.exe: -----------------------------------------------------

Crash Output

Expected Behavior

bucket = {
name="xxx"
...
}

Actual Behavior

Error: error getting S3 Bucket location: Unauthorized: Unauthorized
status code: 401, request id: 2B4619AA7944B507, host id: nwQNmRMsx+YccazGcstBKp3DuZMBkuP7taYc23jugsdQKEjNw9x5d6Hsl+x9Wzz+XFqn2zqPtKI=

Steps to Reproduce

  1. terraform init
  2. terraform apply

Additional Context

References

@ghost ghost added the service/s3 Issues and PRs that pertain to the s3 service. label Oct 9, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 9, 2020
@Jacky-YC
Copy link

Possible related issues: #15420 (comment)

@ebabani
Copy link
Contributor

ebabani commented Oct 30, 2020

It looks related. What AWS region was this on?

There is a PR that should hopefully fix this: #15481

@breathingdust breathingdust added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 16, 2021
@anGie44
Copy link
Contributor

anGie44 commented Apr 12, 2022

Given the provider configuration provided above uses the cn-northwest-1 region, looks like @ebabani's fix in #15481 closes this issue out. @Jacky-YC , reach out if you've found this issue to persist in recent provider versions.

@anGie44 anGie44 closed this as completed Apr 12, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2022
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. service/s3 Issues and PRs that pertain to the s3 service.
Projects
None yet
Development

No branches or pull requests

4 participants