# the 'splunk-addon-for-aws' role is created in all accounts via # the base/account_standards module. # # Then, there is an instance profile (for use in the partition holding moose) # and a user account (for use in the partion _not_ holding moose) that # with keys for moose. # # That instance profile/user is allowed to assumerole into the # 'splunk-addon-for-aws' role in the other accounts. ###################### # Access keys # # For rotation purposes, there are two of these. Delete the oldest one, # add a new one (with a higher version number), and then update the output # # Possible futue improvement: # We could specify a pgp_key attribute, and then the secret will be encrypted # in both the state file and in the output. If we used the salt PGP key, # no user would ever have to see the secret key. resource "aws_iam_access_key" "moose-hf-v1" { user = aws_iam_user.moose-hf.name } resource "aws_iam_access_key" "moose-hf-v2" { user = aws_iam_user.moose-hf.name } output "access_keys" { value = { "current" = { "aws_access_key_id" : aws_iam_access_key.moose-hf-v2.id "aws_secret_access_key" : aws_iam_access_key.moose-hf-v2.secret }, "previous" = { "aws_access_key_id" : aws_iam_access_key.moose-hf-v1.id "aws_secret_access_key" : aws_iam_access_key.moose-hf-v1.secret } } sensitive = true } ###################### # The policy is attached to both the user and the instance profile # tfsec:ignore:aws-iam-no-policy-wildcards - baseline this setting first. We use wildcards in policies resource "aws_iam_policy" "moose-hf" { name = "moose-hf" path = "/instance/" description = "Policy to allow the moose HF to assume roles" policy = <