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

S3 not being created on the right region #16085

Closed
hernan82arg opened this issue Sep 13, 2017 · 2 comments
Closed

S3 not being created on the right region #16085

hernan82arg opened this issue Sep 13, 2017 · 2 comments

Comments

@hernan82arg
Copy link

hernan82arg commented Sep 13, 2017

Hi there,

I've set aws provider to eu-west-2 and I'm trying to create a bucket on us-east-1, when I run the plan I get the bucket is going to be created on the right region, but after I apply, it gets created where the provider is configured (eu-west-2) and if I run plan again, terraform wants to change the region to us-east-1

$ terraform -v
Terraform v0.10.4

region: eu-west-2

Code I'm running:

provider "aws" {
    region = "${var.region}"

    assume_role {
        role_arn     = "arn:aws:iam::${var.account}:role/${var.role}"
        session_name = "Terraform"
    }
}


resource "aws_s3_bucket" "mycompany_logs" {
  bucket = "someTag-${var.project}-${var.environment}-someBucketName"
  acl    = "private"
  region = "us-east-1"

  tags {
      Name = "${var.project}-${var.environment}-someBucketName"
      Project = "${var.project}"
      Environment = "${var.environment}"
  }

  lifecycle {
      prevent_destroy = true
  }
}

Plan output:

Terraform will perform the following actions:

  • aws_s3_bucket.mycompany_logs
    id:
    acceleration_status:
    acl: "private"
    arn:
    bucket: "someTag-someProject-mycompany-logs"
    bucket_domain_name:
    force_destroy: "false"
    hosted_zone_id:
    policy: "{\n "Version": "2012-10-17",\n "Statement": [\n {\n "Effect": "Allow",\n "Principal": {\n "AWS": "arn:aws:iam::107630771604:user/s3-copy"\n },\n "Action": "s3:PutObject",\n "Resource": "arn:aws:s3:::someTag-someProject-somePath/*"\n }\n ]\n}\n"
    region: "us-east-1"
    request_payer:
    tags.%: "3"
    tags.Environment: "dev"
    tags.Name: "someProject-dev-mycompany-logs"
    tags.Project: "someProject"
    versioning.#:
    website_domain:
    website_endpoint:

Apply:

Applying for environment dev
aws_s3_bucket.mycompany_logs: Creating...
acceleration_status: "" => ""
acl: "" => "private"
arn: "" => ""
bucket: "" => "someTag-someProject-dev-mycompany-logs"
bucket_domain_name: "" => ""
force_destroy: "" => "false"
hosted_zone_id: "" => ""
policy: "" => "{\n "Version": "2012-10-17",\n "Statement": [\n {\n "Effect": "Allow",\n "Principal": {\n "AWS": "arn:aws:iam::107630771604:user/s3-copy"\n },\n "Action": "s3:PutObject",\n "Resource": "arn:aws:s3:::someTag-someProject-dev-mycompany-logs/mycompany-logs/*"\n }\n ]\n}\n"
region: "" => "us-east-1"
request_payer: "" => ""
tags.%: "" => "3"
tags.Environment: "" => "dev"
tags.Name: "" => "someProject-dev-mycompany-logs"
tags.Project: "" => "someProject"
versioning.#: "" => ""
website_domain: "" => ""
website_endpoint: "" => ""
aws_s3_bucket.mycompany_logs: Creation complete after 4s (ID: someTag-someProject-dev-mycompany-logs)

Plan after applying:

Terraform will perform the following actions:

~ aws_s3_bucket.mycompany_logs
region: "eu-west-2" => "us-east-1"

Expected Behavior

Create a bucket on us-east-1

Actual Behavior

Created a bucket on us-west-2

Steps to Reproduce

Please list the full steps required to reproduce the issue, for example:

  1. terraform init
  2. terraform plan
  3. terraform apply
  4. terraform plan

Important Factoids

I'm running terraform apply "dev.tfplan" which is the plan I run before applying.

Any idea?

Thanks.

@hashibot
Copy link
Contributor

This issue has been automatically migrated to hashicorp/terraform-provider-aws#1656 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to this issue and let us know.

@ghost
Copy link

ghost commented Jul 24, 2019

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.

@ghost ghost locked and limited conversation to collaborators Jul 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants