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

[Bug]: wrong region used for requests to route53 #34016

Closed
tmccombs opened this issue Oct 19, 2023 · 11 comments · Fixed by #37565 or #37851
Closed

[Bug]: wrong region used for requests to route53 #34016

tmccombs opened this issue Oct 19, 2023 · 11 comments · Fixed by #37565 or #37851
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/route53 Issues and PRs that pertain to the route53 service.
Milestone

Comments

@tmccombs
Copy link
Contributor

tmccombs commented Oct 19, 2023

Terraform Core Version

1.5.0

AWS Provider Version

5.21.0

Affected Resource(s)

aws_route53_record

Expected Behavior

I should be able to use the fips endpoint: https://route53-fips.amazonaws.com. However, it seems the provider hard-codes the use of the us-west-2 region when making requests to route53 and that isn't a valid region for that endpoint.

Actual Behavior

If i use a provider configuration that uses the us-east-1 region, and specify

endpoints {
  route53 = "https://route53-fips.amazonaws.com"
}

then when I try to refresh the state (including as part of a plan) I get an error that the " SignatureDoesNotMatch: Credential should be scoped to a valid region"

Relevant Error/Panic Output Snippet

╷
│ Error: reading Route 53 Record (<REDACTED>): SignatureDoesNotMatch: Credential should be scoped to a valid region.
│ 	status code: 403, request id: c0729919-504b-4889-9b9a-ba49181f09fc
│ 
│   with aws_route53_record.example,
│   on ses.tf line 9, in resource "aws_route53_record" "example":
│    9: resource "aws_route53_record" "example" {
│ 
╵

Terraform Configuration Files

provider "aws" {
  alias = "example"
  # include AWS credentials source
  region = "us-east-1"

  endpoints {
    route53 = "https://route53-fips.amazonaws.com"
  }
}

resource "aws_route53_record" "example" {
  provider = aws.example
  zone_id  = var.zone_id
  name     = ""
  type     = "TXT"
  ttl      = 60
  records  = ["example"]
}

Steps to Reproduce

Create the resource without the custom route53 endpoint. Then run terraform apply -refresh-only to attempt to refresh the state.

Debug Output

2023-10-19T12:54:43.808-0600 [DEBUG] provider.terraform-provider-aws_v5.21.0_x5: HTTP Response Received: rpc.service="Route 53" tf_mux_provider=*schema.GRPCProviderServer tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=dda458c2-5606-1bb9-dc6f-4fc926b1e7b3 http.response.header.content_type=text/xml @module=aws http.duration=427 http.response.header.x_amzn_requestid=8617f94b-5f9e-44c8-9d50-98ce16a38644 http.status_code=403 rpc.system=aws-api tf_resource_type=aws_route53_record aws.region=us-west-2 http.response.header.date="Thu, 19 Oct 2023 18:54:42 GMT" rpc.method=GetHostedZone tf_rpc=ReadResource @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.38/logger.go:157 http.response.body="<?xml version="1.0"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/"><Error><Type>Sender</Type><Code>SignatureDoesNotMatch</Code><Message>Credential should be scoped to a valid region. </Message></Error><RequestId>8617f94b-5f9e-44c8-9d50-98ce16a38644</RequestId></ErrorResponse>
" http.response_content_length=300 tf_aws.sdk=aws-sdk-go timestamp=2023-10-19T12:54:43.808-0600
2023-10-19T12:54:43.809-0600 [ERROR] provider.terraform-provider-aws_v5.21.0_x5: Response contains error diagnostic: tf_rpc=ReadResource @module=sdk.proto diagnostic_severity=ERROR diagnostic_summary="reading Route 53 Record (<REDACTED>__TXT): SignatureDoesNotMatch: Credential should be scoped to a valid region.
	status code: 403, request id: 8617f94b-5f9e-44c8-9d50-98ce16a38644" tf_proto_version=5.4 tf_resource_type=aws_route53_record @caller=github.com/hashicorp/terraform-plugin-go@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_detail= tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=dda458c2-5606-1bb9-dc6f-4fc926b1e7b3 timestamp=2023-10-19T12:54:43.809-0600
2023-10-19T12:54:43.809-0600 [ERROR] vertex "aws_route53_record.example" error: reading Route 53 Record (<REDACTED>__TXT): SignatureDoesNotMatch: Credential should be scoped to a valid region.
	status code: 403, request id: 8617f94b-5f9e-44c8-9d50-98ce16a38644
2023-10-19T12:54:43.809-0600 [ERROR] vertex "aws_route53_record.example (expand)" error: reading Route 53 Record (<REDACTED>__TXT): SignatureDoesNotMatch: Credential should be scoped to a valid region.

Notice that the request uses the "us-west-2" region, despite the fact that I have specified the "us-east-1" region.

Panic Output

No response

Important Factoids

No response

References

Would you like to implement a fix?

None

@tmccombs tmccombs added the bug Addresses a defect in current functionality. label Oct 19, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/route53 Issues and PRs that pertain to the route53 service. label Oct 19, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 19, 2023
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Oct 23, 2023
@AlexSchultz-clumio
Copy link

This also occurs with cloudfront-fips.amazonaws.com which also doesn't have the regional endpoint and suffers from #33952

@kopatsy
Copy link

kopatsy commented Apr 25, 2024

From my experiments, it appears that the regression might have been introduced in v5.5.0 (v5.4.0 works on our workspace, v5.5.0 fails with the SignatureDoesNotMatch error on a route53_hosted_zone resource).

@cadepriest
Copy link

Can confirm this is still an issue this is the error if you set the route53 endpoint even to the amazonaws.com endpoint.

Error: finding Route 53 Hosted Zone: SignatureDoesNotMatch: Credential should be scoped to a valid region.

In this configuration I am using the default endpoint.

provider "aws" {
  region = "us-east-1"
  endpoints {
    route53        = "https://route53.amazonaws.com"
   }
 }

If you force the provider to 5.4 like the previous comment this configuration works

terraform {
 backend "http" {}
 required_providers {
   aws = {
     source  = "hashicorp/aws"
     version = ">= 5.4.0, < 5.5.0"
   }
 }
}

Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot added this to the v5.50.0 milestone May 16, 2024
Copy link

This functionality has been released in v5.50.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@kopatsy
Copy link

kopatsy commented May 29, 2024

It appears that this might have regressed. It works with 5.50.0 and breaks the same way in 5.51.0. I suspect that could be the commit that re-introduced the issue.

@justinretzolk justinretzolk reopened this May 30, 2024
@justinretzolk justinretzolk added the regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. label May 30, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label May 30, 2024
@gdavison gdavison self-assigned this May 31, 2024
@gdavison
Copy link
Contributor

Hi @kopatsy. Are you still seeing this error in v5.52.0? I can't reproduce the error.

If you are seeing it, can you please share your configuration and the debug log?

Copy link

github-actions bot commented Jun 7, 2024

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

@github-actions github-actions bot modified the milestones: v5.50.0, v5.53.0 Jun 7, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 7, 2024
Copy link

github-actions bot commented Jun 7, 2024

This functionality has been released in v5.53.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

Copy link

github-actions bot commented Jul 8, 2024

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 Jul 8, 2024
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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/route53 Issues and PRs that pertain to the route53 service.
Projects
None yet
6 participants