Skip to content

Commit 2dd73ef

Browse files
authored
[aws-sso] Fix root provider, restore SetSourceIdentity permission (cloudposse/terraform-aws-components#830)
1 parent 4e69c99 commit 2dd73ef

File tree

4 files changed

+44
-26
lines changed

4 files changed

+44
-26
lines changed

src/CHANGELOG.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
***NOTE***: This file is manually generated and is a work-in-progress.
44

5-
### PR 740
5+
### PR 830
6+
7+
- Fix `providers.tf` to properly assign roles for `root` account when deploying to `identity` account.
8+
- Restore the `sts:SetSourceIdentity` permission for Identity-role-TeamAccess
9+
permission sets added in PR 738 and inadvertently removed in PR 740.
10+
- Update comments and documentation to reflect Cloud Posse's current
11+
recommendation that SSO ***not*** be delegated to the `identity` account.
12+
13+
### Version 1.240.1, PR 740
614

715
This PR restores compatibility with `account-map` prior to version 1.227.0
816
and fixes bugs that made versions 1.227.0 up to this release unusable.

src/README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,26 @@ This component assumes that AWS SSO has already been enabled via the AWS Console
1212
1. Select primary region
1313
1. Go to AWS SSO
1414
1. Enable AWS SSO
15+
16+
#### Delegation no longer recommended
17+
18+
Previously, Cloud Posse recommended delegating SSO to the identity account by following the next 2 steps:
1519
1. Click Settings > Management
16-
1. Delegate Identity as an administrator
20+
1. Delegate Identity as an administrator. This can take up to 30 minutes to take effect.
21+
22+
However, this is no longer recommended. Because the delegated SSO administrator cannot make changes in the `root` account
23+
and this component needs to be able to make changes in the `root` account, any purported security advantage achieved by
24+
delegating SSO to the `identity` account is lost.
1725

18-
Once identity is delegated, it will take up to 20 to 30 minutes for the identity account to understand its delegation.
26+
Nevertheless, it is also not worth the effort to remove the delegation. If you have already delegated SSO to the `identity`,
27+
continue on, leaving the stack configuration in the `gbl-identity` stack rather than the currently recommended `gbl-root` stack.
1928

2029
### Atmos
2130

2231
**Stack Level**: Global
2332
**Deployment**: Must be deployed by root-admin using `atmos` CLI
2433

25-
Add catalog to `gbl-identity` root stack.
34+
Add catalog to `gbl-root` root stack.
2635

2736
#### `account_assignments`
2837
The `account_assignments` setting configures access to permission sets for users and groups in accounts, in the following structure:

src/policy-Identity-role-TeamAccess.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ data "aws_iam_policy_document" "assume_aws_team" {
1212
effect = "Allow"
1313
actions = [
1414
"sts:AssumeRole",
15+
"sts:SetSourceIdentity",
1516
"sts:TagSession",
1617
]
1718

src/providers.tf

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
# This is a special provider configuration that allows us to use many different
2-
# versions of the Cloud Posse reference architecture to deploy this component
3-
# in any account, including the identity and root accounts.
1+
# This component is unusual in that part of it must be deployed to the `root`
2+
# account. You have the option of where to deploy the remaining part, and
3+
# Cloud Posse recommends you deploy it also to the `root` account, however
4+
# it can be deployed to the `identity` account instead. In the discussion
5+
# below, when we talk about where this module is being deployed, we are
6+
# referring to the part of the module that is not deployed to the `root`
7+
# account and is configured by setting `stage` etc..
48

5-
# If you have dynamic Terraform roles enabled and an `aws-team` (such as `managers`)
6-
# empowered to make changes in the identity and root accounts. Then you can
7-
# use those roles to deploy this component in the identity and root accounts,
8-
# just like almost any other component. Leave `privileged: false` and leave the
9-
# backend `role_arn` at its default value.
9+
# If you have Dynamic Terraform Roles enabled, leave the backend `role_arn` at
10+
# its default value. If deploying only to the `root` account, leave `privileged: false`
11+
# and use either SuperAdmin or an appropriate `aws-team` (such as `managers`).
12+
# If deploying to the `identity` account, set `privileged: true`
13+
# and use SuperAdmin or any other role in the `root` account with Admin access.
1014
#
1115
# For those not using dynamic Terraform roles:
1216
#
13-
# If you are deploying this to the "identity" account and are restricted to using
14-
# the SuperAdmin role to deploy components to "identity", then you will need to
15-
# set the stack configuration for this component to set `privileged: true`
16-
# and backend `role_arn` to `null`.
17+
# Set the stack configuration for this component to set `privileged: true`
18+
# and backend `role_arn` to `null`, and deploy it using either the SuperAdmin
19+
# role or any other role in the `root` account with Admin access.
1720
#
1821
# If you are deploying this to the "identity" account and have a team empowered
19-
# to deploy components to "identity", then you will need to set the stack
20-
# configuration for this component to set `privileged: false` and leave the
21-
# backend `role_arn` at its default value.
22+
# to deploy to both the "identity" and "root" accounts, then you have the option to set
23+
# `privileged: false` and leave the backend `role_arn` at its default value, but
24+
# then SuperAdmin will not be able to deploy this component,
25+
# only the team with access to both accounts will be able to deploy it.
2226
#
23-
# If you are deploying this to the "root" account, then you will need to
24-
# set the stack configuration for this component to set `privileged: true`
25-
# and backend `role_arn` to `null`, and deploy it using either the SuperAdmin
26-
# role or any other role in the `root` account with Admin access.
2727

2828
provider "aws" {
2929
region = var.region
@@ -51,10 +51,10 @@ provider "aws" {
5151
alias = "root"
5252
region = var.region
5353

54-
profile = !var.privileged && module.iam_roles.profiles_enabled ? module.iam_roles.terraform_profile_name : null
54+
profile = !var.privileged && module.iam_roles_root.profiles_enabled ? module.iam_roles_root.terraform_profile_name : null
5555
dynamic "assume_role" {
56-
for_each = !var.privileged && module.iam_roles.profiles_enabled ? [] : (
57-
var.privileged ? compact([module.iam_roles.org_role_arn]) : compact([module.iam_roles.terraform_role_arn])
56+
for_each = !var.privileged && module.iam_roles_root.profiles_enabled ? [] : (
57+
var.privileged ? compact([module.iam_roles_root.org_role_arn]) : compact([module.iam_roles_root.terraform_role_arn])
5858
)
5959
content {
6060
role_arn = assume_role.value

0 commit comments

Comments
 (0)