terrafam makes it easy to create AWS IAM principals (users, roles, and groups) with limited permission to AWS resources. You define your users, roles, and groups, as well as their AWS access policies in terse YML configuration files, with sensible defaults.
You can then generate and use terraform configuration to create the IAM resources.
The resulting access policies can serve as the basic IAM structure for your org; you can decorate with additional IAM resources in terraform, or manually.
example-user:
managed: ["AdministratorAccess"]
example-role:
s3:
read-and-write: ["some-bucket"]
read: ["another-bucket"]
example-group:
dynamodb:
read: ["some-table"]
custom: true
Currently, you can define dynamodb, s3, and sns resources, with read, write, or read-and-write permissions per table, bucket, and topic respectively.
You can also add managed policies (i.e. defined by Amazon) by name, and custom policies, which you can specify in arbitrary JSON.
- Start in your terraform directory, where
aws.regionis defined (see main.tf). - Define the
users.yml,roles.yml, andgroups.ymlfiles. - Make sure the
AWS_REGIONandAWS_ACCOUNT_IDenvironment variables are set. - Download and run scripts/yaml_to_tf.py.
generated_{users,roles,groups}.tf.jsonfiles are generated. - Define
custompolicies in thepoliciesfolder. A user with the nameexample-userwould have a custom policy atpolicies/user/example-user.policy. - Run
terraform get,terraform planandterraform applyto add the resources to your AWS account.