stavxyz / terraform-aws-backend

A Terraform module for your AWS Backend + a guide for bootstrapping your terraform managed project
Apache License 2.0
53 stars 32 forks source link

AWS region as variable #11

Open vadimAnte opened 5 years ago

vadimAnte commented 5 years ago

Hello,

Please add AWS region to variables. Imagine that you are deploying an many AWS regions, but prefer keep all back-end files in one region only.

stavxyz commented 5 years ago

@vadimAnte I think I like this idea, thanks for the suggestion!

I have three questions.

1) Should the region variable have a default, or just be blank?

2) In the case of "no default", what happens when the variable is unset/blank?

3) Would it not be "better" to encourage users to use the AWS_DEFAULT_REGION variable before plan/apply?

cbfx commented 4 years ago
› terraform apply backend.plan

Error: Missing required argument

The argument "region" is required, but was not set.
cbfx commented 4 years ago

@samstav

  1. i think you should allow this as a config option in the backend module.

    module "backend" {
    source = "github.com/samstav/terraform-aws-backend"
    backend_bucket = "somebucket"
    region = "${var.region}"
    }
  2. following the steps in the README.md, the module asked me for a region when i ran the plan command terraform plan -out=backend.plan -target=module.backend. after I chose us-east-1, the error above returned. if there's no default set and the user does not set one, allow it to exit 0.

  3. yes, i will set and try again using AWS_DEFAULT_REGION.

stavxyz commented 4 years ago

Thanks @cbfx.

So, expose the region variable but default it to blank?