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

Module does not work in multi-account environment #2

Open
guilhermeblanco opened this issue Oct 16, 2017 · 0 comments
Open

Module does not work in multi-account environment #2

guilhermeblanco opened this issue Oct 16, 2017 · 0 comments

Comments

@guilhermeblanco
Copy link

Use the basics of providers limits the ability to setup multi-account environments.
In my case, we split the environment into management, production and development as completely independent accounts, drastically simplifying the overload required to provide access to different sectors of the company, such as contractors.

To address this issue, you can expand the provider configuration to something like this:

provider "aws" {
  alias = "kubernetes"
  region = "${var.region}"
  assume_role {
    session_name = "Terraform"
    role_arn = "arn:aws:iam::${var.account}:role/Admin"
  }
}

And then for every AWS resource, data, etc, you need to define the provider, like this:

resource "aws_iam_policy" "master_policy" {
  provider    = "aws.kubernetes"
  name        = "${var.cluster_name}-master"
  path        = "/"
  description = "Policy for role ${var.cluster_name}-master"
  policy      = "${data.template_file.master_policy_json.rendered}"
}
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

1 participant