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

Can't set region other than profile region #37

Closed
gvashchenkolineate opened this issue Jul 10, 2020 · 3 comments
Closed

Can't set region other than profile region #37

gvashchenkolineate opened this issue Jul 10, 2020 · 3 comments

Comments

@gvashchenkolineate
Copy link

Hi everyone!

I can't identify whether problem is on my side or it's an issue in the module.
I'm using the module as a part of my own module
and I'm creating a couple of buckets and all of them get us-west-2 region despite what I'm passing as region var.

Code in my module ./modules/repo/main.tf:

module "s3-bucket" {
  source  = "terraform-aws-modules/s3-bucket/aws"
  version = "1.9.0"
  region = var.bucket-region

  bucket               = "${local.pfx}-${var.bucket-name}-${var.env}"
  acl                  = "private"
  attach_public_policy = false

  versioning = {
    enabled = true
  }

  tags = local.tags
}

Main code ./main.tf :

module "repo-dev" {
  source = "./modules/repo"
  bucket-region = "us-west-2"   // <---------- that's created as expected
  env    = "dev"
}

module "repo-production" {
  source = "./modules/repo"
  bucket-region = "us-east-1"   // <---------- that's dropped to 'us-west-2'
  env    = "production"
}

terraform plan reportings are fine, but after terraform apply both buckets have region us-west-2.

It must be said that I'm using us-west-2 as an AWS provider setting:

provider "aws" {
  version = "~> 2.35"
  profile = var.profile
  region  = "us-west-2"
}

But the docs says that bucket region will override profile region:

region (Optional) If specified, the AWS region this bucket should reside in. Otherwise, the region used by the callee.

Could you please point me out what I'm doing wrong?

Thanks!

@gvashchenkolineate gvashchenkolineate changed the title Can't set region other than 'us-west-2' Can't set region other than profile region Jul 10, 2020
@moosamus
Copy link

moosamus commented Jul 31, 2020

I just ran into this issue, and it appears that this was changed upstream to a read-only attribute: hashicorp/terraform-provider-aws#14127

I believe it can now only use the profile or provider region as you indicated.

@gvashchenkolineate
Copy link
Author

Oh, thanks!

So using different providers for each region can be a solution
like posted by @endofcake in hashicorp/terraform-provider-aws#1656 (comment)

@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 Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants