【问题标题】:Manage IAM Assume Role creation using Terraform使用 Terraform 管理 IAM 代入角色创建
【发布时间】:2020-05-16 08:42:44
【问题描述】:

问题陈述:

我想使用 Terraform 为多个 AWS 账户创建和管理代入 IAM Assume 角色。

要实现的目标

  • 使用 Terraform 模块在所有 AWS 账户中创建 IAM 代入角色

背景

IAM 角色将存在于每个账户中,并且每个账户将具有不同数量的 Assume 角色,因为它将被不同规模的不同团队使用。将通过 Jump AWS 账户授予对该账户的访问权限,用户将从该账户进行身份验证,然后使用 Assume Role URL 切换账户。

例如。

Account A  has two IAM roles: admin_role and developer_role
Account B has three IAM roles: admin_role, poweruser_role and developer_role
Account C is a jump account, and it also has admin_role, poweruser_role and developer_role  IAM role

User A log into Account C(with poweruser_role attached to them user) then assumes to Account B(this account has a trust relationship with Account C) using the same poweruser_role.

对于这种多账户基础设施设置,合适的 Terraform IAM 解决方案是什么?

This solution 说明了如何为所有账户拥有唯一的 IAM 角色,但没有说明当每个账户的 AWS 角色不同时如何处理。

提前致谢。

【问题讨论】:

    标签: amazon-web-services terraform terraform-provider-aws


    【解决方案1】:

    通常,创建 AWS 组织是一种很好的做法。 该组织包含: - 信息安全帐户(您在其中创建用户), - 主计费帐户(用于汇总计费) - 然后,您为每个环境创建一个帐户(例如,登台、 production,dev) 并在它们之间建立信任关系。 通过这样做,您可以获得最大的灵活性。实际上,您可以为不同的帐户创建不同的组,并为单个用户分配一个或多个组。

    例子:

    • CTO 是主计费组、暂存管理员和生产管理员的一部分
    • 内部开发人员是登台和生产管理员的一部分
    • 外部顾问是登台管理员的一部分

    一些参考: https://www.liatrio.com/blog/secure-aws-account-structure-with-terraform-and-terragrunt 对应的github项目: https://github.com/liatrio/aws-accounts-terraform

    【讨论】:

      猜你喜欢
      • 2020-03-26
      • 2020-04-25
      • 2018-09-09
      • 2019-04-22
      • 1970-01-01
      • 2018-01-15
      • 2019-09-08
      • 1970-01-01
      • 2017-01-31
      相关资源
      最近更新 更多