hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.72k stars 9.08k forks source link

[Bug]: vpc_region argument of aws_route53_zone_association & aws_route53_vpc_association_authorization lacks support of cn-northwest-1 #38403

Open Monster-Zhu opened 1 month ago

Monster-Zhu commented 1 month ago

Terraform Core Version

1.5.7

AWS Provider Version

5.51.0,5.52.0,5.53.0,5.54.0,5.55.0,5.56.0,5.57.0,5.58.0

Affected Resource(s)

Expected Behavior

terraform validate successfully.

Actual Behavior

terraform validate failed with error.

Relevant Error/Panic Output Snippet

╷
│ Error: expected vpc_region to be one of ["us-east-1" "us-east-2" "us-west-1" "us-west-2" "eu-west-1" "eu-west-2" "eu-west-3" "eu-central-1" "eu-central-2" "ap-east-1" "me-south-1" "us-gov-west-1" "us-gov-east-1" "us-iso-east-1" "us-iso-west-1" "us-isob-east-1" "me-central-1" "ap-southeast-1" "ap-southeast-2" "ap-southeast-3" "ap-south-1" "ap-south-2" "ap-northeast-1" "ap-northeast-2" "ap-northeast-3" "eu-north-1" "sa-east-1" "ca-central-1" "cn-north-1" "af-south-1" "eu-south-1" "eu-south-2" "ap-southeast-4" "il-central-1" "ca-west-1"], got cn-northwest-1
│
│   with aws_route53_vpc_association_authorization.main,
│   on main.tf line 13, in resource "aws_route53_vpc_association_authorization" "main":
│   13:   vpc_region = "cn-northwest-1"
│
╵

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = ">=5.51.0, <=5.58.0"
    }
  }
}

resource "aws_route53_vpc_association_authorization" "main" {
  zone_id    = "XYZ"
  vpc_id     = "vpc-abc"
  vpc_region = "cn-northwest-1"
}

resource "aws_route53_zone_association" "main" {
  zone_id    = aws_route53_vpc_association_authorization.main.zone_id
  vpc_id     = aws_route53_vpc_association_authorization.main.vpc_id
  vpc_region = aws_route53_vpc_association_authorization.main.vpc_region
}

Steps to Reproduce

  1. terraform init
  2. terraform validate

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

stefanfreitag commented 1 month ago

Hi @Monster-Zhu, I had a look into the issue you described and the current provider code. Here you can see the validation that happens for the vpc_region. Internally your provided value cn-northwest-1 will be checked against the contents of the awstypes.VPCRegion.

awstypes.VPCRegion is imported from the AWS Go SDK v2 and it seems that support is missing there. You can find the latest docs here. The content is as below (VPCRegionCnNorth1 for cn-north-1 is part, an entry for cn-northwest-1 is missing)

type VPCRegion [string](https://pkg.go.dev/builtin#string)
const (
    VPCRegionUsEast1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-east-1"
    VPCRegionUsEast2      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-east-2"
    VPCRegionUsWest1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-west-1"
    VPCRegionUsWest2      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-west-2"
    VPCRegionEuWest1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-west-1"
    VPCRegionEuWest2      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-west-2"
    VPCRegionEuWest3      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-west-3"
    VPCRegionEuCentral1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-central-1"
    VPCRegionEuCentral2   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-central-2"
    VPCRegionApEast1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-east-1"
    VPCRegionMeSouth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "me-south-1"
    VPCRegionUsGovWest1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-gov-west-1"
    VPCRegionUsGovEast1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-gov-east-1"
    VPCRegionUsIsoEast1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-iso-east-1"
    VPCRegionUsIsoWest1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-iso-west-1"
    VPCRegionUsIsobEast1  [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "us-isob-east-1"
    VPCRegionMeCentral1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "me-central-1"
    VPCRegionApSoutheast1 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-southeast-1"
    VPCRegionApSoutheast2 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-southeast-2"
    VPCRegionApSoutheast3 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-southeast-3"
    VPCRegionApSouth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-south-1"
    VPCRegionApSouth2     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-south-2"
    VPCRegionApNortheast1 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-northeast-1"
    VPCRegionApNortheast2 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-northeast-2"
    VPCRegionApNortheast3 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-northeast-3"
    VPCRegionEuNorth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-north-1"
    VPCRegionSaEast1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "sa-east-1"
    VPCRegionCaCentral1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ca-central-1"
    VPCRegionCnNorth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "cn-north-1"
    VPCRegionAfSouth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "af-south-1"
    VPCRegionEuSouth1     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-south-1"
    VPCRegionEuSouth2     [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "eu-south-2"
    VPCRegionApSoutheast4 [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ap-southeast-4"
    VPCRegionIlCentral1   [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "il-central-1"
    VPCRegionCaWest1      [VPCRegion](https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/route53/types#VPCRegion) = "ca-west-1"
)

Hope that helps a bit to understand the issue.