Skip to content

Suggestion: Improve clarity of some of the examples #55

@philomory

Description

@philomory

There's two areas where I feel like the examples are a bit lacking:

  1. There's no examples (in either the README, or in any of the individual example directories) of how to use a customer-managed policy; the lack of examples, combined with the fact that the data type for permission_sets is listed simply as any rather than having an enforced structure, means that the only way to even know that the key is supposed to be customer_managed_policies is to look at the code; and to figure out what the value of the key should be, you need to either reason through the code yourself, or do some trial and error (I mean, it turns out to be the "obvious" option, which is that it's just an array of strings, each of which is a policy name; but it wouldn't be that weird to expect it to be an array of maps with name and path keys, like the customer_managed_policy_reference attribute in the ssoadmin_customer_managed_policy_attachment resource)
  2. In the existing-users-and-groups example, there's some (apparent) conflation between the map keys used to reference users and groups, the value of the principal_name key within an account assignment, and the value of the user_name/group_name keys in the existing_sso_users and existing_sso_groups entries. From reading the module, I was able to suss out the following:
    • The map keys within existing_sso_users and existing_sso_groups can be whatever you want them to be, but you'll need to refer to them later.
    • The value of the user_name and group_name keys within the individual records in those maps, needs to match the actual name of the record in Identity Center.
    • The map keys within the account_assignments map are completely arbitrary and don't need to match anything (and good thing, too; if the map key needed to match the principal then you couldn't have multiple records for the same principal).
    • The value of the principal_name key in the account assignment needs to match the key from the existing_sso_users or existing_sso_groups map.

That's all well and good, but, in the examples the same value is used in all four places. It'd be a lot clearer if the example looked like, e.g.

existing_sso_users = {
  testuser : {
    user_name = "[email protected]"
  }
}
existing_sso_groups = {
  testgroup : {
    group_name = "Test Group"
  }
}

account_assignments = {
  testgroup_admin : {
      principal_name  = "testgroup"
      principal_type  = "GROUP"
      principal_idp   = "EXTERNAL"
      permission_sets = ["AdministratorAccess", "ViewOnlyAccess", ]
      account_ids = [...]
  }
  testgroup_poweruser : {
      principal_name  = "testgroup"
      principal_type  = "GROUP"
      principal_idp   = "EXTERNAL"
      permission_sets = ["PowerUserAccess", "ViewOnlyAccess", ]
      account_ids = [...]
  }
  testuser_something : {
      principal_name  = "testuser"
      principal_type  = "USER"
      principal_idp   = "EXTERNAL"
      permission_sets = ["ViewOnlyAccess"]
      account_ids = [...]
  }
}

This would make it much more clear which specific keys and values need to match each other (especially since the name of the principal_name key really makes it sound as it's supposed to be the actual record name that AWS sees, e.g. [email protected] or Test Group, etc).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions