Skip to content

Terraform module to build an AWS IAM related resources (such as Roles)

License

Notifications You must be signed in to change notification settings

tierratelematics/terraform-aws-iam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-iam

This repository is a set of Terraform modules for defining IAM resources.

Quickstart

The easiest way to get the modules and running is by creating a Terraform definition for it, copy this snippet in a file named main.tf:

module "asg-server-role" {
  source = "git::https://github.com/tierratelematics/terraform-aws-iam.git//modules/role?ref=0.2.0"

  project     = "${var.project}"
  environment = "${var.environment}"
  subject     = "backend-asg"

  principals = [
    "ec2.amazonaws.com",
  ]

  actions = [
    "logs:CreateLogGroup",
    "logs:CreateLogStream",
    "logs:PutLogEvents",
    "logs:Describe*",
    "logs:PutRetentionPolicy",
    "ec2:Describe*",
  ]
}

More Examples

Existing Policies

When you already have an existing AWS managed policy you can attach it to the role using the policies argument:

module "asg-server-role" {

  ...

  policies = [
    "arn:aws:iam::aws:policy/AmazonS3FullAccess",
    "arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole",
  ]
}

New Custom Policy

If you need a very focused custom policy for your role all you have to do is specify a list of required actions:

module "asg-server-role" {

  ...

  actions = [
    "logs:CreateLogGroup",
    "logs:CreateLogStream",
    "logs:PutLogEvents",
    "logs:Describe*",
    "logs:PutRetentionPolicy",
    "ec2:Describe*",
  ]
}

License

Copyright 2018 Tierra SpA

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Terraform module to build an AWS IAM related resources (such as Roles)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages