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

Support passing custom aws provider #6

Closed
olds463 opened this issue Jul 6, 2021 · 3 comments
Closed

Support passing custom aws provider #6

olds463 opened this issue Jul 6, 2021 · 3 comments

Comments

@olds463
Copy link

olds463 commented Jul 6, 2021

For multi-region deployments it'd be nice to add to your modules an AWS provider configuration so we may duplicate the modules for multiple regions

example:

  providers = { aws = aws.ca-central-1 }
@jparnaudeau
Copy link
Owner

jparnaudeau commented Jul 7, 2021

Hi,
sorry i don't understand what you want. From my point of view, module code should be independent of tthe region. If i need to use my module in different region, i will do something like this 👍

# define provider in main region
provider "aws" {
  region = "eu-central-1"
}
# define provider in DR region
provider "aws" {
  alias  = "dr_region"
  region = "eu-west-1"
}

# deploy module on main region
module "ssm_main" {
  ...
}

# deploy module on dr region
module "ssm_dr" {
  providers = {
    aws = aws.dr_region
  }
  ...
}

@olds463
Copy link
Author

olds463 commented Jul 7, 2021

Hmm I receive the following on latest terraform

│ Warning: Provider aws is undefined
│ 
│   on maintenance-windows.tf line 85, in module "ssm-patch-management-canada":
│   85:   providers = { aws = aws.ca-central-1 }
│ 
│ Module module.ssm-patch-management-canada does not declare a provider named aws.
│ If you wish to specify a provider configuration for the module, add an entry for aws in the required_providers block within the module.
│ 
│ (and 2 more similar warnings elsewhere)

In your modules you need todo something like the below ( i think, atleast i works when I copy your module local)

terraform {
  required_providers {
    aws = {
      source                = "hashicorp/aws"
      version               = ">= 2.7.0"
    }
  }
}

@jparnaudeau
Copy link
Owner

Hi,

you have right ! I have pushed a new version v1.1.0 with a compatibility with 0.15 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants