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

Terraform v0.11.2 with provider.aws v1.7.0 doesn't support region cn-northwest-1 #3053

Closed
hashibot opened this issue Jan 18, 2018 · 5 comments
Labels
enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS.
Milestone

Comments

@hashibot
Copy link

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


Hello,

I am trying to ran terraform upon the new launched China region cn-northwest-1 with following version

Terraform Version

$ terraform -v
Terraform v0.11.2
+ provider.aws v1.7.0
+ provider.null v1.0.0

I also checked the github code, it seems with version I am running has the region supported
8499d2e#diff-59e28844253678de7bce92be14f06597

I have no idea the issue here, could you please help me !

Thanks

Terraform Configuration Files

Debug Output

Crash Output

$ terraform plan
var.environment
  The environment of the resource

  Enter a value: dev

Acquiring state lock. This may take a few moments...
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.

data.null_data_source.configuration: Refreshing state...

Error: Error refreshing state: 1 error(s) occurred:

* provider.aws: Not a valid region: cn-northwest-1

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

References

@hashibot hashibot added the enhancement Requests to existing resources that expand the functionality or scope. label Jan 18, 2018
@yydoow
Copy link

yydoow commented Jan 19, 2018

My aws cli works fine upon the region, it looks like the provider issue

$ aws --region cn-northwest-1 s3 ls s3://apitrail
                           PRE AWSLogs/

@kwerey
Copy link
Contributor

kwerey commented Jan 26, 2018

I hit this also in:

$ terraform -version
Terraform v0.11.2
+ provider.aws v1.7.1

Kinda looks like it just needs adding to accepted params for the ValidateRegion() function in config.go

// ValidateRegion returns an error if the configured region is not a
// valid aws region and nil otherwise.
func (c *Config) ValidateRegion() error {
	var regions = []string{
		"ap-northeast-1",
		"ap-northeast-2",
		"ap-south-1",
		"ap-southeast-1",
		"ap-southeast-2",
		"ca-central-1",
		"cn-north-1",
		"eu-central-1",
		"eu-west-1",
		"eu-west-2",
		"eu-west-3",
		"sa-east-1",
		"us-east-1",
		"us-east-2",
		"us-gov-west-1",
		"us-west-1",
		"us-west-2",
	}

	for _, valid := range regions {
		if c.Region == valid {
			return nil
		}
	}
	return fmt.Errorf("Not a valid region: %s", c.Region)
}

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/config.go#L495

I also notice there's an IsChinaCloud flag that's currently only set for cn-north-1. I wouldn't be surprised if this needs setting for cn-northwest-1 to construct China service endpoints correctly:

func (c *AWSClient) IsChinaCloud() bool {
	if c.region == "cn-north-1" {
		return true
	}
	return false
}

https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/config.go#L223

I don't have a go dev environment, but if it's quick and easy to set one up, I'll try fixing it and put in a PR if it really is this simple ;)

@bflad bflad closed this as completed in faba5c7 Jan 26, 2018
bflad added a commit that referenced this issue Jan 26, 2018
Support AWS cn-northwest-1 Ningxia (fixes #3053)
@bflad
Copy link
Contributor

bflad commented Jan 26, 2018

Support for this new region has been merged into master and will be released with v1.8.0, hopefully later today.

@bflad bflad added this to the v1.8.0 milestone Jan 26, 2018
@bflad bflad added the provider Pertains to the provider itself, rather than any interaction with AWS. label Jan 29, 2018
@bflad
Copy link
Contributor

bflad commented Jan 29, 2018

This has been released in terraform-provider-aws version 1.8.0. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

Important note: if you're planning on using cn-northwest-1 S3 for backend state, this PR (or newer version of it) needs to be merged and released in Terraform core (which will be 0.11.3+): hashicorp/terraform#17216

jocgir added a commit to coveord/terraform-provider-aws that referenced this issue Jan 31, 2018
* commit '8937a3a4e9d77c8089cf147861b604e3a2d8cf7e': (47 commits)
  v1.8.0
  Update CHANGELOG.md
  resource/aws_dynamodb_table: Refactoring (hashicorp#3136)
  Update CHANGELOG for hashicorp#3171
  resource/aws_elastic_beanstalk_application: Prevent crash on reading missing application
  chore(vendor): bump aws-sdk-go to v1.12.70
  typo guardduty import test
  Update CHANGELOG for hashicorp#3142
  Removed empty strings
  test/aws_dynamodb_global_table: Use single region for basic and import testing
  resource/aws_sqs_queue: Retry creation on QueueDeletedRecently for additional 10 seconds
  docs/CONTRIBUTING: Use aws_cloudwatch_dashboard for acceptance test examples
  docs/CONTRIBUTING: New Region: don't add empty mappings
  Update CHANGELOG.md
  resource/aws_rds_cluster: Retry deletion on InvalidDBClusterStateFault
  docs/CONTRIBUTING: Remove pre-split provider directory references from testacc commands
  Add service account IDs
  docs/CONTRIBUTING: New Region
  Support AWS cn-northwest-1 Ningxia (fixes hashicorp#3053)
  Update CHANGELOG.md
  ...

# Conflicts:
#	aws/validators.go
@ghost
Copy link

ghost commented Apr 8, 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 Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. provider Pertains to the provider itself, rather than any interaction with AWS.
Projects
None yet
Development

No branches or pull requests

4 participants