# Contains roles used for gathering inventory across AWS accounts # These roles are assumed into from the salt-master instance in order to # gather data about the instances. # # This is a low risk policy that provides view only access to select # services. locals { # Trust these ARNs: # # Commercial - Trust the user in C2 # GovCloud - Trust the role in C2 # # Test - Trust both prod and test C2 arns # Prod - Trust only the prod C2 arns # # Note: No support for the legacy salt master is included. The # new govcloud salt masters will be 100% repsonsible for # the inventory. trusted_arns_map = { "test" = { "aws" = [ "arn:aws:iam::045312110490:user/instance/salt-master", # mdr-prod-c2 "arn:aws:iam::816914342178:user/instance/salt-master", # mdr-test-c2 ], "aws-us-gov" = [ "arn:aws-us-gov:iam::721817724804:role/salt-master-instance-role", # mdr-prod-c2-gov "arn:aws-us-gov:iam::738800754746:role/salt-master-instance-role", # mdr-test-c2-gov ] }, "prod" = { "aws" = [ "arn:aws:iam::045312110490:user/instance/salt-master", # mdr-prod-c2 ], "aws-us-gov" = [ "arn:aws-us-gov:iam::721817724804:role/salt-master-instance-role", # mdr-prod-c2-gov ] }, "common" = { "aws" = [ "arn:aws:iam::045312110490:user/instance/salt-master", # mdr-prod-c2 ], "aws-us-gov" = [ "arn:aws-us-gov:iam::721817724804:role/salt-master-instance-role", # mdr-prod-c2-gov ] } } trusted_arns = local.trusted_arns_map[var.environment][var.aws_partition] } resource "aws_iam_role" "salt_master_inventory_role" { depends_on = [aws_iam_user.salt-master] name = "salt-master-inventory-role" path = "/service/" force_detach_policies = true # causes "DeleteConflict" if not present # the extra_trusted_salt variable allows the addition of additional # trusted sources, such as the dev salt master (for dev environments) # and developer users. assume_role_policy = <